Methods Summary |
---|
public Message | createMessage(byte[] id_bytes, DirectByteBuffer message_data, byte version)Construct a new message instance from the given message information.
Message message = (Message)message_map.get( id_bytes );
if( message == null ) {
throw new MessageException( "message id[" + new String( id_bytes) + "] not registered" );
}
return message.deserialize( message_data, version );
|
public void | deregisterMessageType(Message message)Remove registration of given message type from manager.
try{ this_mon.enter();
message_map.remove( message.getIDBytes() );
messages.remove( message );
}
finally{ this_mon.exit(); }
|
public Message[] | getRegisteredMessages()Get a list of the registered messages.
return (Message[])messages.toArray( new Message[messages.size()] );
|
public static com.aelitis.azureus.core.peermanager.messaging.MessageManager | getSingleton() return instance;
|
public void | initialize()Perform manager initialization.
AZMessageFactory.init(); //register AZ message types
BTMessageFactory.init(); //register BT message types
|
public Message | lookupMessage(java.lang.String id)Lookup a registered message type via id and version.
return (Message)message_map.get( id.getBytes());
|
public Message | lookupMessage(byte[] id_bytes)
return (Message)message_map.get( id_bytes );
|
public void | registerMessageType(Message message)Register the given message type with the manager for processing.
try{
this_mon.enter();
byte[] id_bytes = message.getIDBytes();
if( message_map.containsKey( id_bytes ) ) {
throw new MessageException( "message type [" +message.getID()+ "] already registered!" );
}
message_map.put( id_bytes, message );
messages.add( message );
}finally{
this_mon.exit();
}
|