if ( args.length > 0 ) {
port = Integer.parseInt( args[ 0 ] );
}
System.out.print( "Initializing..." );
Intrepid intrepid = Intrepid.create(
new IntrepidSetup().serverPort( port ).openServer() );
intrepid.addPerformanceListener( new PerformanceListener() {
@Override
public void inboundRemoteCallCompleted( VMID instance_vmid, long time,
int call_id, Object result, boolean result_was_thrown ) {
System.out.println( "INBOUND call completed: " + call_id );
}
@Override
public void remoteCallStarted( VMID instance_vmid, long time, int call_id,
VMID destination_vmid, int object_id, int method_id, Method method,
Object[] args, UserContextInfo user_context, String persistent_name ) {
System.out.println( "call started: " + call_id + " - " + method );
}
@Override
public void remoteCallCompleted( VMID instance_vmid, long time, int call_id,
Object result, boolean result_was_thrown, Long server_time ) {
System.out.println( "call completed: " + call_id );
}
@Override
public void inboundRemoteCallStarted( VMID instance_vmid, long time,
int call_id, VMID source_vmid, int object_id, int method_id,
Method method, Object[] args, UserContextInfo user_context,
String persistent_name ) {
System.out.println( "INBOUND call started: " + call_id );
}
@Override
public void virtualChannelClosed( VMID instance_vmid, VMID peer_vmid,
short channel_id ) {
// TODO: implement
}
@Override
public void virtualChannelOpened( VMID instance_vmid, VMID peer_vmid,
short channel_id ) {
// TODO: implement
}
@Override
public void virtualChannelDataReceived( VMID instance_vmid, VMID peer_vmid,
short channel_id, int bytes ) {
// TODO: implement
}
@Override
public void virtualChannelDataSent( VMID instance_vmid, VMID peer_vmid,
short channel_id, int bytes ) {
// TODO: implement
}
@Override
public void messageReceived( VMID source_vmid, IMessage message ) {}
@Override
public void messageSent( VMID destination_vmid, IMessage message ) {}
@Override
public void leasedObjectRemoved( VMID vmid, int object_id ) {}
@Override
public void leaseInfoUpdated( VMID vmid, int object_id,
String delegate_tostring, boolean holding_strong_reference,
int leasing_vm_count, boolean renew, boolean release ) {}
} );
System.out.println( "done." );
System.out.print( "Binding to registry..." );
intrepid.getLocalRegistry().bind( ServerInterface.class.getName(), new TestServer() );
System.out.println( "done." );
System.out.println( "Server ready!" );
new Thread() {