Exemplo n.º 1
0
  /** Helper method to get broker that is relevant to the specified service request */
  @SuppressWarnings("rawtypes")
  private static Broker findBroker(ServiceKey serviceKey) throws ServiceException {
    Broker brokerToReturn = null;

    ServiceInfo serviceInfo = BrokerFactory.serviceRegistry.getServiceInfo(serviceKey);
    // if service info not found i.e not a valid service key or the service configuration is in
    // error, throw a
    // ServiceException
    if (serviceInfo == null) {
      throw new ServiceException(getMissingServiceMessage(serviceKey));
    }

    brokerToReturn = new BrokerImpl(serviceInfo);
    ((BrokerImpl) brokerToReturn).setServiceContainer(BrokerFactory.serviceContainer);
    return brokerToReturn;
  }
Exemplo n.º 2
0
 /** Close on finalize. */
 protected void finalize() throws Throwable {
   super.finalize();
   if (!isClosed()) free();
 }