public synchronized long register(T o) {
    checkNotNull(o);
    Long nativeId = nativeObjToIdMap.inverse().get(o);
    if (nativeId != null) {
      if (debug) {
        DebugInfo debugInfo = idToDebugInfoMap.get(nativeId);
        if (debugInfo != null) {
          System.out.printf(
              "NativeObjRegistry %s: register %d -> %s already registered:%n", name, nativeId, o);
          debugInfo.registrationTrace.printStackTrace(System.out);
        }
      }
      throw new IllegalStateException("Object was previously registered with id " + nativeId);
    }

    nativeId = nextId;
    if (debug) {
      System.out.printf("NativeObjRegistry %s: register %d -> %s%n", name, nativeId, o);
      idToDebugInfoMap.put(nativeId, new DebugInfo(new Trace(o)));
    }
    nativeObjToIdMap.put(nativeId, o);
    nextId++;
    return nativeId;
  }
public synchronized long register(T o) {
    checkNotNull(o);
    Long nativeId = nativeObjToIdMap.inverse().get(o);
    if (nativeId != null) {
      if (debug) {
        DebugInfo debugInfo = idToDebugInfoMap.get(nativeId);
        if (debugInfo != null) {
          System.out.printf(
              "NativeObjRegistry %s: register %d -> %s already registered:%n", name, nativeId, o);
          debugInfo.registrationTrace.printStackTrace(System.out);
        }
      }
      throw new IllegalStateException("Object was previously registered with id " + nativeId);
    }

    nativeId = nextId;
    if (debug) {
      System.out.printf("NativeObjRegistry %s: register %d -> %s%n", name, nativeId, o);
      idToDebugInfoMap.put(nativeId, new DebugInfo(new Trace(o)));
    }
    nativeObjToIdMap.put(nativeId, o);
    nextId++;
    return nativeId;
  }
public synchronized long register ( T o ) { checkNotNull ( o ) ; Long nativeId = nativeObjToIdMap . inverse ( ) . get ( o ) ; if ( nativeId != null ) { if ( debug ) { DebugInfo debugInfo = idToDebugInfoMap . get ( nativeId ) ; if ( debugInfo != null ) { System . out . printf ( "NativeObjRegistry %s: register %d -> %s already registered:%n" , name , nativeId , o ) ; debugInfo . registrationTrace . printStackTrace ( System . out ) ; } } throw new IllegalStateException ( "Object was previously registered with id " + nativeId ) ; } nativeId = nextId ; if ( debug ) { System . out . printf ( "NativeObjRegistry %s: register %d -> %s%n" , name , nativeId , o ) ; idToDebugInfoMap . put ( nativeId , new DebugInfo ( new Trace ( o ) ) ) ; } nativeObjToIdMap . put ( nativeId , o ) ; nextId ++ ; return nativeId ; }
Register and assign a new unique native id for given object (representing a C memory pointer).

@throws IllegalStateException if the object was previously registered
Register and assign a new unique native id for given object ( representing a C memory pointer ) .