Package ch.marcsladek.jrtnp.connection

Examples of ch.marcsladek.jrtnp.connection.Connection


   * @return the new Conenction
   * @throws IOException
   *           when unable to listen to socket
   */
  public synchronized Connection newClient(Socket socket) throws IOException {
    Connection client = factory.newInstance(socket);
    return clientPool.add(client.getIdentifier(), client);
  }
View Full Code Here


   * @param identifier
   *          specifies Connection
   * @return whether was successful or not
   */
  public synchronized boolean removeClient(String identifier) {
    Connection client = clientPool.remove(identifier);
    boolean success = false;
    if (client != null) {
      try {
        client.shutdown();
        success = true;
      } catch (IOException e) {
      }
    }
    return success;
View Full Code Here

   * @throws IOException
   *           when unable to access socket
   */
  public final synchronized boolean send(String identifier, Object obj)
      throws IOException {
    Connection client = clientPool.get(identifier);
    if (client != null) {
      return client.send(obj);
    } else {
      return false;
    }
  }
View Full Code Here

   * @throws IOException
   *           when unable to listen to socket
   */
  public final void newClient(Socket socket) {
    try {
      Connection newClient = factory.newInstance(socket);
      if (clientMap.putIfAbsent(newClient.getIdentifier(), newClient) == null) {
        newClientNotExistent(newClient);
      } else {
        newClientExistent(newClient);
      }
    } catch (IOException exp) {
View Full Code Here

   * @param identifier
   *          specifies Connection
   * @return whether was successful or not
   */
  public final boolean removeClient(String identifier) {
    Connection client = clientMap.remove(identifier);
    boolean success;
    if (client != null) {
      success = removeClientRemoved(client);
    } else {
      success = removeClientNotRemoved(client);
View Full Code Here

   * @return whether was successful or not
   * @throws IOException
   *           when unable to access socket
   */
  public final boolean send(String identifier, Object obj) throws IOException {
    Connection client = clientMap.get(identifier);
    if (client != null) {
      return client.send(obj);
    } else {
      return false;
    }
  }
View Full Code Here

   * @throws IOException
   *           when unable to listen to socket
   */
  public final void newClient(Socket socket) {
    try {
      Connection newClient = factory.newInstance(socket);
      if (clientMap.putIfAbsent(newClient.getIdentifier(), newClient) == null) {
        newClientNotExistent(newClient);
      } else {
        newClientExistent(newClient);
      }
    } catch (IOException exp) {
View Full Code Here

   * @return removed Connection if successful
   * @throws ClientNotConnectedException
   *           is thrown when given Connection is not connected
   */
  public final Connection removeClient(String identifier) throws ClientNotConnectedException {
    Connection client = clientMap.remove(identifier);
    if (client != null) {
      removed(client);
      return client;
    } else {
      throw new ClientNotConnectedException(identifier);
View Full Code Here

   * @throws ClientNotConnectedException
   *           is thrown when given Connection is not connected
   */
  public final void send(String identifier, Object obj) throws IOException,
      ClientNotConnectedException {
    Connection client = clientMap.get(identifier);
    if (client != null) {
      client.send(obj);
    } else {
      throw new ClientNotConnectedException(identifier);
    }
  }
View Full Code Here

   * @return address of specified Connection
   * @throws ClientNotConnectedException
   *           is thrown when given Connection is not connected
   */
  public final String getAddressOf(String identifier) throws ClientNotConnectedException {
    Connection client = clientMap.get(identifier);
    if (client != null) {
      return client.getAddress();
    } else {
      throw new ClientNotConnectedException(identifier);
    }
  }
View Full Code Here

TOP

Related Classes of ch.marcsladek.jrtnp.connection.Connection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.