p2pMapReduce.impl.networkModule.jxta
Class JxtaBidiPipeConnection_old

java.lang.Object
  extended by p2pMapReduce.impl.networkModule.jxta.JxtaBidiPipeConnection_old
All Implemented Interfaces:
java.util.EventListener, net.jxta.endpoint.MessengerStateListener, net.jxta.pipe.PipeMsgListener, net.jxta.util.PipeEventListener, net.jxta.util.PipeStateListener, ConnectionIF

public class JxtaBidiPipeConnection_old
extends java.lang.Object
implements ConnectionIF, net.jxta.pipe.PipeMsgListener, net.jxta.util.PipeStateListener, net.jxta.util.PipeEventListener, net.jxta.endpoint.MessengerStateListener

During the creation of a JxtaBidiPipe an exchange of the node info is made between the two connection endpoint. If no nodeinfo is received after a timeout the constructor throws a IOException


Field Summary
static int CHECK_TIMEOUT
           
static int CONNECTION_OPENING_TIMEOUT
          Time to wait for receiving remote node info.
static java.lang.String MESSAGE_ELEMENT_NAME
           
static java.lang.String MESSAGE_NAMESPACE_NAME
           
static int RECEIVE_TIMEOUT
           
 
Fields inherited from interface net.jxta.util.PipeStateListener
PIPE_CLOSED_EVENT, PIPE_FAILED_EVENT, PIPE_OPENED_EVENT
 
Constructor Summary
JxtaBidiPipeConnection_old(net.jxta.util.JxtaBiDiPipe bipipe, net.jxta.peergroup.PeerGroup peerGroup, NodeInfo local, JxtaNetworkModule netModule, EventNotifier eventNotifier)
          Used when a remote connection is received
JxtaBidiPipeConnection_old(net.jxta.peergroup.PeerGroup peerGroup, NodeInfo local, NodeInfo remote, net.jxta.protocol.PipeAdvertisement pipeADV, JxtaNetworkModule netModule, EventNotifier eventNotifier)
          Use to open a new connection towards the specified pipe adv
 
Method Summary
 void close()
          Close the connection
protected  void finalize()
           
 NodeInfo getRemoteNodeInfo()
           
 boolean isBroken()
          Indicate if the connection is no longer capable to send message and receive messages
 boolean isDisconnected()
           
 boolean messengerStateChanged(int newState)
           
 void pipeEvent(int event)
           
 void pipeMsgEvent(net.jxta.pipe.PipeMsgEvent event)
           
 java.io.Serializable receive()
           
 void send(java.io.Serializable o)
          Used to send a serializable object through this connection
 void setEventNotifier(EventNotifier eventNotifier)
           
 void stateEvent(java.lang.Object source, int event)
          Deprecated. non richiamato dal bidipipe quando il pipelistener è gia specificato
 java.lang.String toString()
          Remote PeerID toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONNECTION_OPENING_TIMEOUT

public static final int CONNECTION_OPENING_TIMEOUT
Time to wait for receiving remote node info. If it is not received in time an IOException is thrown //TODO tuning this parameter and provide setter method

See Also:
Constant Field Values

RECEIVE_TIMEOUT

public static final int RECEIVE_TIMEOUT
See Also:
Constant Field Values

CHECK_TIMEOUT

public static final int CHECK_TIMEOUT
See Also:
Constant Field Values

MESSAGE_ELEMENT_NAME

public static final java.lang.String MESSAGE_ELEMENT_NAME
See Also:
Constant Field Values

MESSAGE_NAMESPACE_NAME

public static final java.lang.String MESSAGE_NAMESPACE_NAME
See Also:
Constant Field Values
Constructor Detail

JxtaBidiPipeConnection_old

public JxtaBidiPipeConnection_old(net.jxta.peergroup.PeerGroup peerGroup,
                                  NodeInfo local,
                                  NodeInfo remote,
                                  net.jxta.protocol.PipeAdvertisement pipeADV,
                                  JxtaNetworkModule netModule,
                                  EventNotifier eventNotifier)
                           throws java.io.IOException
Use to open a new connection towards the specified pipe adv

Parameters:
peerGroup -
pipeADV -
Throws:
java.io.IOException

JxtaBidiPipeConnection_old

public JxtaBidiPipeConnection_old(net.jxta.util.JxtaBiDiPipe bipipe,
                                  net.jxta.peergroup.PeerGroup peerGroup,
                                  NodeInfo local,
                                  JxtaNetworkModule netModule,
                                  EventNotifier eventNotifier)
                           throws java.io.IOException
Used when a remote connection is received

Parameters:
bipipe -
Throws:
java.io.IOException
Method Detail

send

public void send(java.io.Serializable o)
          throws java.io.IOException
Description copied from interface: ConnectionIF
Used to send a serializable object through this connection

Specified by:
send in interface ConnectionIF
Throws:
java.io.IOException

pipeMsgEvent

public void pipeMsgEvent(net.jxta.pipe.PipeMsgEvent event)
Specified by:
pipeMsgEvent in interface net.jxta.pipe.PipeMsgListener

receive

public java.io.Serializable receive()
                             throws java.io.IOException
Specified by:
receive in interface ConnectionIF
Returns:
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Description copied from interface: ConnectionIF
Close the connection

Specified by:
close in interface ConnectionIF
Throws:
java.io.IOException

isDisconnected

public boolean isDisconnected()

isBroken

public boolean isBroken()
Description copied from interface: ConnectionIF
Indicate if the connection is no longer capable to send message and receive messages

Specified by:
isBroken in interface ConnectionIF
Returns:

getRemoteNodeInfo

public NodeInfo getRemoteNodeInfo()
Specified by:
getRemoteNodeInfo in interface ConnectionIF

setEventNotifier

public void setEventNotifier(EventNotifier eventNotifier)

stateEvent

@Deprecated
public void stateEvent(java.lang.Object source,
                                  int event)
Deprecated. non richiamato dal bidipipe quando il pipelistener è gia specificato

Specified by:
stateEvent in interface net.jxta.util.PipeStateListener
Parameters:
source -
event -

pipeEvent

public void pipeEvent(int event)
Specified by:
pipeEvent in interface net.jxta.util.PipeEventListener

messengerStateChanged

public boolean messengerStateChanged(int newState)
Specified by:
messengerStateChanged in interface net.jxta.endpoint.MessengerStateListener

toString

public java.lang.String toString()
Remote PeerID toString

Overrides:
toString in class java.lang.Object
Returns:

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable