Class CascadedClient

java.lang.Object
org.serviceconnector.casc.CascadedClient

public class CascadedClient extends Object
The Class CascadedClient.
  • Constructor Details

    • CascadedClient

      public CascadedClient(CascadedSC cascadedSC, CascadedPublishService publishService)
      Instantiates a new cascaded client.
      Parameters:
      cascadedSC - the cascaded sc
      publishService - 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

      public void setSubscriptionId(String subscriptionId)
      Sets the subscription id.
      Parameters:
      subscriptionId - the new subscription id
    • getSubscriptionId

      public String 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

      public Semaphore getCascClientSemaphore()
      Gets the casc client semaphore.
      Returns:
      the casc client semaphore
    • setSubscriptionMask

      public void setSubscriptionMask(SubscriptionMask newSubscriptionMask)
      Sets the subscription mask.
      Parameters:
      newSubscriptionMask - the new subscription mask
    • evalSubscriptionMaskFromClientSubscriptions

      public String evalSubscriptionMaskFromClientSubscriptions()
      Eval subscription mask from client subscriptions.
      Returns:
      the string
    • getSubscriptionMask

      public SubscriptionMask getSubscriptionMask()
      Gets the subscription mask.
      Returns:
      the subscription mask
    • getServiceName

      public String getServiceName()
      Gets the service name.
      Returns:
      the service name
    • getPublishService

      public CascadedPublishService getPublishService()
      Gets the publish service.
      Returns:
      the publish service
    • getClientSubscriptionIds

      public Map<String,SubscriptionMask> 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 id
      clientMask - the client mask
      Throws:
      InvalidMaskLengthException - the invalid mask length exception
    • removeClientSubscriptionId

      public void removeClientSubscriptionId(String clientSubscriptionId)
      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

      public CascadedSC 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

      public SCMPMessageSequenceNr 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.