Examples of IntrepidSPI


Examples of com.starlight.intrepid.spi.IntrepidSPI

    Intrepid instance = Intrepid.findInstanceWithRemoteSession( vmid );
    if ( instance == null ) {
      throw new NotConnectedException( "No instance found with connection.", vmid );
    }

    IntrepidSPI spi;
    try {
      spi = instance.getSPI();
    }
    catch ( IllegalStateException ex ) {
      throw new NotConnectedException(
        "Invalid SPI state: " + ex.getMessage(), vmid );
    }

    IMessage message;
    if ( renew ) message = new LeaseIMessage( object_id );
    else message = new LeaseReleaseIMessage( object_id );

    spi.sendMessage( vmid, message, null );
  }
View Full Code Here

Examples of com.starlight.intrepid.spi.IntrepidSPI

  public static Intrepid create( IntrepidSetup setup )
    throws IOException {

    if ( setup == null ) setup = new IntrepidSetup();

    IntrepidSPI spi = setup.getSPI();
    if ( spi == null ) spi = new MINAIntrepidSPI();

    ScheduledExecutor thread_pool = setup.getThreadPool();
    if ( thread_pool == null ) {
      thread_pool = SharedThreadPool.INSTANCE;
    }

    InetAddress server_address = setup.getServerAddress();
    Integer server_port = setup.getServerPort();
    AuthenticationHandler auth_handler = setup.getAuthHandler();
    String vmid_hint = setup.getVMIDHint();
    if ( vmid_hint == null ) {
      if ( server_address != null ) vmid_hint = server_address.getHostAddress();
      else {
        try {
          InetAddress local_host = InetAddress.getLocalHost();
          if ( local_host != null ) {
            vmid_hint = local_host.getHostAddress();
            // Weed out silly IP's.
            if ( vmid_hint.equals( "127.0.0.1" ) ) vmid_hint = null;
          }
        }
        catch ( UnknownHostException ex ) {
          // ignore
        }
      }
    }

    ListenerSupport<ConnectionListener,Void> connection_listeners =
      ListenerSupportFactory.create( ConnectionListener.class, false );
    if ( setup.getConnectionListener() != null ) {
      connection_listeners.add( setup.getConnectionListener() );
    }

    ListenerSupport<PerformanceListener,Void> performance_listeners =
      ListenerSupportFactory.create( PerformanceListener.class, false );
    final PerformanceListener perf_listener = setup.getPerformanceListener();
    if ( perf_listener != null ) {
      performance_listeners.add( perf_listener );
    }

    VMID vmid = new VMID( UUID.randomUUID(), vmid_hint );

    // Create handlers
    LocalCallHandler local_handler =
      new LocalCallHandler( vmid, performance_listeners.dispatch() );
    RemoteCallHandler remote_handler = new RemoteCallHandler( spi, auth_handler,
      local_handler, vmid, thread_pool, performance_listeners,
      setup.getChannelAcceptor() );

    // Init SPI
    spi.init( server_address, server_port, vmid_hint, remote_handler,
      connection_listeners.dispatch(), thread_pool, vmid,
      ProxyInvocationHandler.DESERIALIZING_VMID, performance_listeners.dispatch(),
      setup.getUnitTestHook() );

    Intrepid instance = new Intrepid( spi, vmid, local_handler, remote_handler,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.