Ejemplo n.º 1
0
  public Object makeObject(Object key) throws Exception {
    UMOImmutableEndpoint ep = (UMOImmutableEndpoint) key;
    int port = ep.getEndpointURI().getPort();
    InetAddress inetAddress = InetAddress.getByName(ep.getEndpointURI().getHost());
    Socket socket = createSocket(port, inetAddress);
    socket.setReuseAddress(true);

    TcpConnector connector = (TcpConnector) ep.getConnector();
    connector.configureSocket(TcpConnector.CLIENT, socket);

    return socket;
  }
Ejemplo n.º 2
0
  public void passivateObject(Object key, Object object) throws Exception {
    UMOImmutableEndpoint ep = (UMOImmutableEndpoint) key;

    boolean keepSocketOpen =
        MapUtils.getBooleanValue(
            ep.getProperties(),
            TcpConnector.KEEP_SEND_SOCKET_OPEN_PROPERTY,
            ((TcpConnector) ep.getConnector()).isKeepSendSocketOpen());
    Socket socket = (Socket) object;

    if (!keepSocketOpen) {
      try {
        if (socket != null) {
          socket.close();
        }
      } catch (IOException e) {
        logger.debug("Failed to close socket after dispatch: " + e.getMessage());
      }
    }
  }
Ejemplo n.º 3
0
 public XmppMessageDispatcher(UMOImmutableEndpoint endpoint) {
   super(endpoint);
   this.connector = (XmppConnector) endpoint.getConnector();
 }