Package org.serviceconnector.casc
Class CascadedClient
java.lang.Object
org.serviceconnector.casc.CascadedClient
The Class CascadedClient.
-
Constructor Summary
ConstructorsConstructorDescriptionCascadedClient(CascadedSC cascadedSC, CascadedPublishService publishService) Instantiates a new cascaded client. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClientSubscriptionId(String clientSubscriptionId, SubscriptionMask clientMask) Adds the client subscription id.voiddestroy()Destroy cascaded client.Eval subscription mask from client subscriptions.Gets the cascaded sc.Gets the casc client semaphore.Gets the client subscription ids.Gets the msg sequence nr.Gets the publish service.Gets the service name.Gets the subscription id.Gets the subscription mask.intIncrement and checks semaphore permit denial counter.booleanChecks if is destroyed.booleanChecks if is subscribed.voidReceive publication.voidReceive publication part - needed for polling large publication.voidremoveClientSubscriptionId(String clientSubscriptionId) Removes the client subscription id.voidReset semaphore permit denial counter.voidsetSubscribed(boolean subscribed) Sets the subscribed.voidsetSubscriptionId(String subscriptionId) Sets the subscription id.voidsetSubscriptionMask(SubscriptionMask newSubscriptionMask) Sets the subscription mask.
-
Constructor Details
-
CascadedClient
Instantiates a new cascaded client.- Parameters:
cascadedSC- the cascaded scpublishService- the publish service
-
-
Method Details
-
isSubscribed
public boolean isSubscribed()Checks if is subscribed.- Returns:
- true, if is subscribed
-
setSubscribed
public void setSubscribed(boolean subscribed) Sets the subscribed.- Parameters:
subscribed- the new subscribed
-
setSubscriptionId
Sets the subscription id.- Parameters:
subscriptionId- the new subscription id
-
getSubscriptionId
Gets the subscription id.- Returns:
- the subscription id
-
incrementAndCheckSemaphorePermitDenialCounter
public int incrementAndCheckSemaphorePermitDenialCounter()Increment and checks semaphore permit denial counter. If the counter achieves 5 this cascaded client destroys himself. It should never appear. It under some circumstances releasing the semaphore fails it continues running fine after destroying. -
resetSemaphorePermitDenialCounter
public void resetSemaphorePermitDenialCounter()Reset semaphore permit denial counter. -
getCascClientSemaphore
Gets the casc client semaphore.- Returns:
- the casc client semaphore
-
setSubscriptionMask
Sets the subscription mask.- Parameters:
newSubscriptionMask- the new subscription mask
-
evalSubscriptionMaskFromClientSubscriptions
Eval subscription mask from client subscriptions.- Returns:
- the string
-
getSubscriptionMask
Gets the subscription mask.- Returns:
- the subscription mask
-
getServiceName
Gets the service name.- Returns:
- the service name
-
getPublishService
Gets the publish service.- Returns:
- the publish service
-
getClientSubscriptionIds
Gets the client subscription ids.- Returns:
- the client subscription ids
-
addClientSubscriptionId
public void addClientSubscriptionId(String clientSubscriptionId, SubscriptionMask clientMask) throws InvalidMaskLengthException Adds the client subscription id.- Parameters:
clientSubscriptionId- the client subscription idclientMask- the client mask- Throws:
InvalidMaskLengthException- the invalid mask length exception
-
removeClientSubscriptionId
Removes the client subscription id.- Parameters:
clientSubscriptionId- the client subscription id
-
receivePublication
public void receivePublication()Receive publication. -
receivePublicationPart
public void receivePublicationPart()Receive publication part - needed for polling large publication. -
getCascadedSC
Gets the cascaded sc.- Returns:
- the cascaded sc
-
isDestroyed
public boolean isDestroyed()Checks if is destroyed. Careful in use - destroy method renews the client. This method is only to use if u are still holding the same instance. On the service it might be a new cascaded client instance in the meantime.- Returns:
- true, if is destroyed
-
getMsgSequenceNr
Gets the msg sequence nr.- Returns:
- the msg sequence nr
-
destroy
public void destroy()Destroy cascaded client. A cascaded can only be destroyed once. After destroying use of client is forbidden. The publish service gets a new instance of CascadedClient which holds current subscribers. Destroy should be called having a permit to avoid errors in proceeding subscribe/unsubscribe/changeSubscription. Destroy releases any thread waiting for a permit on semaphore. It unsubscribes the current cascaded client.
-