Package com.starlight.intrepid

Examples of com.starlight.intrepid.VMID



  public static <T> void dropToCaller( ID<T> id, T object, boolean compress )
    throws ChannelRejectedException, IOException {

    VMID vmid = IntrepidContext.getCallingVMID();
    Intrepid instance = IntrepidContext.getActiveInstance();

    if ( vmid != null && instance == null ) {
      throw new IllegalStateException(
        Resources.ERROR_DROP_WITH_VMID_BUT_NO_INSTANCE.getValue() );
View Full Code Here


          //       so clearing the vmid_remap really isn't an issue.
          if ( original_vmid != null ) disconnect( original_vmid );
          return;
        }

        VMID vmid = inner_connect( host_and_port.getHost(),
          host_and_port.getPort(), container.getConnectionArgs(),
          reconnect_token, attachment, TimeUnit.SECONDS.toNanos( 30 ),
          container, original_vmid );

        if ( container.isCanceled() ) {
View Full Code Here

    ValidationKit.checkNonnull( vmid, "VMID" );

    session.setAttribute( MINAIntrepidSPI.INVOKE_ACK_RATE,
      Byte.valueOf( ack_rate_sec ) );

    VMID old_vmid = ( VMID ) session.setAttribute( MINAIntrepidSPI.VMID_KEY, vmid );

    if ( LOG.isDebugEnabled() ) {
      StringBuilder buf = new StringBuilder();
      boolean first = true;
      for( Object key : session.getAttributeKeys() ) {
View Full Code Here

  }


  public static void main( String[] args ) throws Exception {
    Intrepid intrepid = Intrepid.create( null );
    VMID server_vmid = intrepid.connect( InetAddress.getLocalHost(),
      Integer.parseInt( args[ 0 ] ), null, null );

    intrepid.addPerformanceListener( new LeaseListener() );

    Registry registry = intrepid.getRemoteRegistry( server_vmid );
View Full Code Here

          "  (timeout was " + timeout_unit.toMillis( timeout ) + ")" );
      }

      // NOTE: session won't be set in the container until after the VMID attribute
      //       is set, so it's safe to use this rather than the VMID future.
      VMID session_vmid = ( VMID ) session.getAttribute( VMID_KEY );
      assert session_vmid != null;
      assert session_map.containsKey( session_vmid );
      return session_vmid;
    }

    boolean abend = true;
    try {
      long remaining = timeout_unit.toNanos( timeout );

      IOException exception = null;

      connection_listener.connectionOpening( address, port, attachment, args,
        connection_type_description );

      boolean first = true;
      while( first || ( keep_trying && remaining > 0 ) ) {

        long start = System.nanoTime();
        try {
          if ( first ) first = false;
          else {
            // Wait a second.
            if ( !ThreadKit.sleep( 1000 ) ) {
              throw new InterruptedIOException();
            }
          }

          for( int i = 0; i < 3; i++ ) {
            try {
              VMID vmid = inner_connect( address, port, args, null,
                attachment, remaining, container, null );
              if ( vmid != null ) {
                abend = false;
                return vmid;
              }
              break;
            }
            catch( IOException ex ) {
              exception = ex;

              // If the exception has a cause and it's an instance of
              // MINA's RuntimeIoException, try again. This is trying to
              // work around a problem in the JDK where this exception is
              // received when setting keep alive and nodelay flags:
              //   Caused by: org.apache.mina.core.RuntimeIoException:
              //     java.net.SocketException: Invalid argument:
              //     no further information
              //     at ...NioSocketSession$SessionConfigImpl.setKeepAlive(NioSocketSession.java:133)
              if ( ex.getCause() != null &&
                ex.getCause() instanceof RuntimeIoException ) {

                // continue
              }
              else break;
            }
          }
        }
        finally {
          remaining -= System.nanoTime() - start;

          if ( abend ) {
            connection_listener.connectionOpenFailed( address, port,
              attachment, exception, remaining > 0 );
          }
        }
      }

      if ( exception == null ) {
        exception = new ConnectException( "Connect timed out: " + host_and_port );
      }

      throw exception;
    }
    catch ( InterruptedException e ) {
      InterruptedIOException ex = new InterruptedIOException();
      ex.initCause( e );
      throw ex;
    }
    finally {
      // If the connection failed, clean up the outbound_session_map
      if ( abend ) {
        map_lock.lock();
        try {
          SessionContainer pulled_container =
            outbound_session_map.remove( host_and_port );
          if ( pulled_container != null && pulled_container == container ) {
            // Make sure it doesn't have a VMID, and clean up if it does
            IoSession session = pulled_container.getSession();

            if ( session != null ) {
              CloseHandler.close( session );

              VMID vmid = ( VMID ) session.getAttribute( VMID_KEY );
              if ( vmid != null ) {
                SessionContainer session_map_container =
                  session_map.remove( vmid );

                if ( session_map_container != pulled_container ) {
View Full Code Here

    AtomicInteger protocol_version_slot ) throws IOException {

    Integer message_id = Integer.valueOf( System.identityHashCode( message ) );
    LOG.debug( "Send message (ID:{}): ", message_id, message );

    VMID new_vmid;

    // If there's an artificial delay, sleep now
    if ( message_send_delay != null ) {
      ThreadKit.sleep( message_send_delay.longValue() );
    }
View Full Code Here

    final SessionContainer container =
      ( SessionContainer ) session.getAttribute( CONTAINER_KEY );
    if ( container != null ) container.setSession( null );

    final VMID vmid = ( VMID ) session.getAttribute( VMID_KEY );
    final Object attachment = session.getAttribute( ATTACHMENT_KEY );

    // Kill the session reconnect token timer, if it exists
    ScheduledFuture<?> regen_timer = ( ScheduledFuture<?> ) session.getAttribute(
      RECONNECT_TOKEN_REGENERATION_TIMER );
View Full Code Here

    byte min_protocol_version = buffer.get();

    // PREF PROTOCOL VERSION
    byte pref_protocol_version = buffer.get();

    VMID vmid;
    ConnectionArgs connection_args;
    try {
      // VMID
      vmid = ( VMID ) IoBufferSerialization.getObject( buffer );
View Full Code Here

    byte version = buffer.get();

    // PROTOCOL VERSION
    byte protocol_version = buffer.get();

    VMID vmid;
    try {
      // VMID
      vmid = ( VMID ) IoBufferSerialization.getObject( buffer );
    }
    catch( Exception ex ) {
View Full Code Here

TOP

Related Classes of com.starlight.intrepid.VMID

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.