com.sun.corba.se.spi.activation.ServerAlreadyRegistered Java Examples

The following examples show how to use com.sun.corba.se.spi.activation.ServerAlreadyRegistered. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RepositoryImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public int registerServer(ServerDef serverDef)
    throws ServerAlreadyRegistered, BadServerDefinition
{
    // verify that the entry is valid
    LegacyServerSocketEndPointInfo endpoint =
        orb.getLegacyServerSocketManager()
            .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
    int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
        .getServerSocket().getLocalPort();
    ServerTableEntry entry = new ServerTableEntry( wrapper,
        illegalServerId, serverDef, (int) initSvcPort, "", true, debug );

    switch (entry.verify()) {
    case ServerMain.OK:
        break;
    case ServerMain.MAIN_CLASS_NOT_FOUND:
        throw new BadServerDefinition("main class not found.");
    case ServerMain.NO_MAIN_METHOD:
        throw new BadServerDefinition("no main method found.");
    case ServerMain.APPLICATION_ERROR:
        throw new BadServerDefinition("server application error.");
    default:
        throw new BadServerDefinition("unknown Exception.");
    }

    return registerServer(serverDef, illegalServerId);
}
 
Example #2
Source File: RepositoryImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public int registerServer(ServerDef serverDef)
    throws ServerAlreadyRegistered, BadServerDefinition
{
    // verify that the entry is valid
    LegacyServerSocketEndPointInfo endpoint =
        orb.getLegacyServerSocketManager()
            .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
    int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
        .getServerSocket().getLocalPort();
    ServerTableEntry entry = new ServerTableEntry( wrapper,
        illegalServerId, serverDef, (int) initSvcPort, "", true, debug );

    switch (entry.verify()) {
    case ServerMain.OK:
        break;
    case ServerMain.MAIN_CLASS_NOT_FOUND:
        throw new BadServerDefinition("main class not found.");
    case ServerMain.NO_MAIN_METHOD:
        throw new BadServerDefinition("no main method found.");
    case ServerMain.APPLICATION_ERROR:
        throw new BadServerDefinition("server application error.");
    default:
        throw new BadServerDefinition("unknown Exception.");
    }

    return registerServer(serverDef, illegalServerId);
}
 
Example #3
Source File: RepositoryImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public int registerServer(ServerDef serverDef)
    throws ServerAlreadyRegistered, BadServerDefinition
{
    // verify that the entry is valid
    LegacyServerSocketEndPointInfo endpoint =
        orb.getLegacyServerSocketManager()
            .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
    int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
        .getServerSocket().getLocalPort();
    ServerTableEntry entry = new ServerTableEntry( wrapper,
        illegalServerId, serverDef, (int) initSvcPort, "", true, debug );

    switch (entry.verify()) {
    case ServerMain.OK:
        break;
    case ServerMain.MAIN_CLASS_NOT_FOUND:
        throw new BadServerDefinition("main class not found.");
    case ServerMain.NO_MAIN_METHOD:
        throw new BadServerDefinition("no main method found.");
    case ServerMain.APPLICATION_ERROR:
        throw new BadServerDefinition("server application error.");
    default:
        throw new BadServerDefinition("unknown Exception.");
    }

    return registerServer(serverDef, illegalServerId);
}
 
Example #4
Source File: RepositoryImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public int registerServer(ServerDef serverDef)
    throws ServerAlreadyRegistered, BadServerDefinition
{
    // verify that the entry is valid
    LegacyServerSocketEndPointInfo endpoint =
        orb.getLegacyServerSocketManager()
            .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
    int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
        .getServerSocket().getLocalPort();
    ServerTableEntry entry = new ServerTableEntry( wrapper,
        illegalServerId, serverDef, (int) initSvcPort, "", true, debug );

    switch (entry.verify()) {
    case ServerMain.OK:
        break;
    case ServerMain.MAIN_CLASS_NOT_FOUND:
        throw new BadServerDefinition("main class not found.");
    case ServerMain.NO_MAIN_METHOD:
        throw new BadServerDefinition("no main method found.");
    case ServerMain.APPLICATION_ERROR:
        throw new BadServerDefinition("server application error.");
    default:
        throw new BadServerDefinition("unknown Exception.");
    }

    return registerServer(serverDef, illegalServerId);
}
 
Example #5
Source File: RepositoryImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public int registerServer(ServerDef serverDef)
    throws ServerAlreadyRegistered, BadServerDefinition
{
    // verify that the entry is valid
    LegacyServerSocketEndPointInfo endpoint =
        orb.getLegacyServerSocketManager()
            .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
    int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
        .getServerSocket().getLocalPort();
    ServerTableEntry entry = new ServerTableEntry( wrapper,
        illegalServerId, serverDef, (int) initSvcPort, "", true, debug );

    switch (entry.verify()) {
    case ServerMain.OK:
        break;
    case ServerMain.MAIN_CLASS_NOT_FOUND:
        throw new BadServerDefinition("main class not found.");
    case ServerMain.NO_MAIN_METHOD:
        throw new BadServerDefinition("no main method found.");
    case ServerMain.APPLICATION_ERROR:
        throw new BadServerDefinition("server application error.");
    default:
        throw new BadServerDefinition("unknown Exception.");
    }

    return registerServer(serverDef, illegalServerId);
}
 
Example #6
Source File: RepositoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public int registerServer(ServerDef serverDef)
    throws ServerAlreadyRegistered, BadServerDefinition
{
    // verify that the entry is valid
    LegacyServerSocketEndPointInfo endpoint =
        orb.getLegacyServerSocketManager()
            .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
    int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
        .getServerSocket().getLocalPort();
    ServerTableEntry entry = new ServerTableEntry( wrapper,
        illegalServerId, serverDef, (int) initSvcPort, "", true, debug );

    switch (entry.verify()) {
    case ServerMain.OK:
        break;
    case ServerMain.MAIN_CLASS_NOT_FOUND:
        throw new BadServerDefinition("main class not found.");
    case ServerMain.NO_MAIN_METHOD:
        throw new BadServerDefinition("no main method found.");
    case ServerMain.APPLICATION_ERROR:
        throw new BadServerDefinition("server application error.");
    default:
        throw new BadServerDefinition("unknown Exception.");
    }

    return registerServer(serverDef, illegalServerId);
}
 
Example #7
Source File: RepositoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public int registerServer(ServerDef serverDef)
    throws ServerAlreadyRegistered, BadServerDefinition
{
    // verify that the entry is valid
    LegacyServerSocketEndPointInfo endpoint =
        orb.getLegacyServerSocketManager()
            .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
    int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
        .getServerSocket().getLocalPort();
    ServerTableEntry entry = new ServerTableEntry( wrapper,
        illegalServerId, serverDef, (int) initSvcPort, "", true, debug );

    switch (entry.verify()) {
    case ServerMain.OK:
        break;
    case ServerMain.MAIN_CLASS_NOT_FOUND:
        throw new BadServerDefinition("main class not found.");
    case ServerMain.NO_MAIN_METHOD:
        throw new BadServerDefinition("no main method found.");
    case ServerMain.APPLICATION_ERROR:
        throw new BadServerDefinition("server application error.");
    default:
        throw new BadServerDefinition("unknown Exception.");
    }

    return registerServer(serverDef, illegalServerId);
}
 
Example #8
Source File: RepositoryImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public int registerServer(ServerDef serverDef)
    throws ServerAlreadyRegistered, BadServerDefinition
{
    // verify that the entry is valid
    LegacyServerSocketEndPointInfo endpoint =
        orb.getLegacyServerSocketManager()
            .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
    int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
        .getServerSocket().getLocalPort();
    ServerTableEntry entry = new ServerTableEntry( wrapper,
        illegalServerId, serverDef, (int) initSvcPort, "", true, debug );

    switch (entry.verify()) {
    case ServerMain.OK:
        break;
    case ServerMain.MAIN_CLASS_NOT_FOUND:
        throw new BadServerDefinition("main class not found.");
    case ServerMain.NO_MAIN_METHOD:
        throw new BadServerDefinition("no main method found.");
    case ServerMain.APPLICATION_ERROR:
        throw new BadServerDefinition("server application error.");
    default:
        throw new BadServerDefinition("unknown Exception.");
    }

    return registerServer(serverDef, illegalServerId);
}
 
Example #9
Source File: RepositoryImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public int registerServer(ServerDef serverDef)
    throws ServerAlreadyRegistered, BadServerDefinition
{
    // verify that the entry is valid
    LegacyServerSocketEndPointInfo endpoint =
        orb.getLegacyServerSocketManager()
            .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
    int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
        .getServerSocket().getLocalPort();
    ServerTableEntry entry = new ServerTableEntry( wrapper,
        illegalServerId, serverDef, (int) initSvcPort, "", true, debug );

    switch (entry.verify()) {
    case ServerMain.OK:
        break;
    case ServerMain.MAIN_CLASS_NOT_FOUND:
        throw new BadServerDefinition("main class not found.");
    case ServerMain.NO_MAIN_METHOD:
        throw new BadServerDefinition("no main method found.");
    case ServerMain.APPLICATION_ERROR:
        throw new BadServerDefinition("server application error.");
    default:
        throw new BadServerDefinition("unknown Exception.");
    }

    return registerServer(serverDef, illegalServerId);
}
 
Example #10
Source File: RepositoryImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public int registerServer(ServerDef serverDef)
    throws ServerAlreadyRegistered, BadServerDefinition
{
    // verify that the entry is valid
    LegacyServerSocketEndPointInfo endpoint =
        orb.getLegacyServerSocketManager()
            .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
    int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
        .getServerSocket().getLocalPort();
    ServerTableEntry entry = new ServerTableEntry( wrapper,
        illegalServerId, serverDef, (int) initSvcPort, "", true, debug );

    switch (entry.verify()) {
    case ServerMain.OK:
        break;
    case ServerMain.MAIN_CLASS_NOT_FOUND:
        throw new BadServerDefinition("main class not found.");
    case ServerMain.NO_MAIN_METHOD:
        throw new BadServerDefinition("no main method found.");
    case ServerMain.APPLICATION_ERROR:
        throw new BadServerDefinition("server application error.");
    default:
        throw new BadServerDefinition("unknown Exception.");
    }

    return registerServer(serverDef, illegalServerId);
}
 
Example #11
Source File: RepositoryImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public int registerServer(ServerDef serverDef, int theServerId)
    throws ServerAlreadyRegistered
{
    int         serverId;
    DBServerDef server = null;

    synchronized (db) {

        // check if server already registered
        Enumeration enumeration = db.serverTable.elements();
        while (enumeration.hasMoreElements()) {
            server = (DBServerDef) enumeration.nextElement();
            if (serverDef.applicationName.equals(server.applicationName)) {
                if (debug)
                    System.out.println(
                        "RepositoryImpl: registerServer called " +
                        "to register ServerDef " +
                        printServerDef( serverDef ) +
                        " with " + ((theServerId==illegalServerId) ?
                    "a new server Id" : ("server Id " + theServerId)) +
                                       " FAILED because it is already registered." ) ;

                throw (new ServerAlreadyRegistered(server.id));
            }
        }

        // generate a new server id
        if (theServerId == illegalServerId)
            serverId = db.incrementServerIdCounter();
        else
            serverId = theServerId;

        // add server def to the database
        server = new DBServerDef(serverDef, serverId);
        db.serverTable.put(new Integer(serverId), server);
        db.flush();

        if (debug)
            if (theServerId==illegalServerId)
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with new serverId " + serverId ) ;
            else
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with assigned serverId " + serverId ) ;

        return serverId;
    }
}
 
Example #12
Source File: RepositoryImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public int registerServer(ServerDef serverDef, int theServerId)
    throws ServerAlreadyRegistered
{
    int         serverId;
    DBServerDef server = null;

    synchronized (db) {

        // check if server already registered
        Enumeration enumeration = db.serverTable.elements();
        while (enumeration.hasMoreElements()) {
            server = (DBServerDef) enumeration.nextElement();
            if (serverDef.applicationName.equals(server.applicationName)) {
                if (debug)
                    System.out.println(
                        "RepositoryImpl: registerServer called " +
                        "to register ServerDef " +
                        printServerDef( serverDef ) +
                        " with " + ((theServerId==illegalServerId) ?
                    "a new server Id" : ("server Id " + theServerId)) +
                                       " FAILED because it is already registered." ) ;

                throw (new ServerAlreadyRegistered(server.id));
            }
        }

        // generate a new server id
        if (theServerId == illegalServerId)
            serverId = db.incrementServerIdCounter();
        else
            serverId = theServerId;

        // add server def to the database
        server = new DBServerDef(serverDef, serverId);
        db.serverTable.put(new Integer(serverId), server);
        db.flush();

        if (debug)
            if (theServerId==illegalServerId)
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with new serverId " + serverId ) ;
            else
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with assigned serverId " + serverId ) ;

        return serverId;
    }
}
 
Example #13
Source File: RepositoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public int registerServer(ServerDef serverDef, int theServerId)
    throws ServerAlreadyRegistered
{
    int         serverId;
    DBServerDef server = null;

    synchronized (db) {

        // check if server already registered
        Enumeration enumeration = db.serverTable.elements();
        while (enumeration.hasMoreElements()) {
            server = (DBServerDef) enumeration.nextElement();
            if (serverDef.applicationName.equals(server.applicationName)) {
                if (debug)
                    System.out.println(
                        "RepositoryImpl: registerServer called " +
                        "to register ServerDef " +
                        printServerDef( serverDef ) +
                        " with " + ((theServerId==illegalServerId) ?
                    "a new server Id" : ("server Id " + theServerId)) +
                                       " FAILED because it is already registered." ) ;

                throw (new ServerAlreadyRegistered(server.id));
            }
        }

        // generate a new server id
        if (theServerId == illegalServerId)
            serverId = db.incrementServerIdCounter();
        else
            serverId = theServerId;

        // add server def to the database
        server = new DBServerDef(serverDef, serverId);
        db.serverTable.put(new Integer(serverId), server);
        db.flush();

        if (debug)
            if (theServerId==illegalServerId)
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with new serverId " + serverId ) ;
            else
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with assigned serverId " + serverId ) ;

        return serverId;
    }
}
 
Example #14
Source File: RepositoryImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public int registerServer(ServerDef serverDef, int theServerId)
    throws ServerAlreadyRegistered
{
    int         serverId;
    DBServerDef server = null;

    synchronized (db) {

        // check if server already registered
        Enumeration enumeration = db.serverTable.elements();
        while (enumeration.hasMoreElements()) {
            server = (DBServerDef) enumeration.nextElement();
            if (serverDef.applicationName.equals(server.applicationName)) {
                if (debug)
                    System.out.println(
                        "RepositoryImpl: registerServer called " +
                        "to register ServerDef " +
                        printServerDef( serverDef ) +
                        " with " + ((theServerId==illegalServerId) ?
                    "a new server Id" : ("server Id " + theServerId)) +
                                       " FAILED because it is already registered." ) ;

                throw (new ServerAlreadyRegistered(server.id));
            }
        }

        // generate a new server id
        if (theServerId == illegalServerId)
            serverId = db.incrementServerIdCounter();
        else
            serverId = theServerId;

        // add server def to the database
        server = new DBServerDef(serverDef, serverId);
        db.serverTable.put(new Integer(serverId), server);
        db.flush();

        if (debug)
            if (theServerId==illegalServerId)
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with new serverId " + serverId ) ;
            else
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with assigned serverId " + serverId ) ;

        return serverId;
    }
}
 
Example #15
Source File: RepositoryImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public int registerServer(ServerDef serverDef, int theServerId)
    throws ServerAlreadyRegistered
{
    int         serverId;
    DBServerDef server = null;

    synchronized (db) {

        // check if server already registered
        Enumeration enumeration = db.serverTable.elements();
        while (enumeration.hasMoreElements()) {
            server = (DBServerDef) enumeration.nextElement();
            if (serverDef.applicationName.equals(server.applicationName)) {
                if (debug)
                    System.out.println(
                        "RepositoryImpl: registerServer called " +
                        "to register ServerDef " +
                        printServerDef( serverDef ) +
                        " with " + ((theServerId==illegalServerId) ?
                    "a new server Id" : ("server Id " + theServerId)) +
                                       " FAILED because it is already registered." ) ;

                throw (new ServerAlreadyRegistered(server.id));
            }
        }

        // generate a new server id
        if (theServerId == illegalServerId)
            serverId = db.incrementServerIdCounter();
        else
            serverId = theServerId;

        // add server def to the database
        server = new DBServerDef(serverDef, serverId);
        db.serverTable.put(new Integer(serverId), server);
        db.flush();

        if (debug)
            if (theServerId==illegalServerId)
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with new serverId " + serverId ) ;
            else
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with assigned serverId " + serverId ) ;

        return serverId;
    }
}
 
Example #16
Source File: RepositoryImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public int registerServer(ServerDef serverDef, int theServerId)
    throws ServerAlreadyRegistered
{
    int         serverId;
    DBServerDef server = null;

    synchronized (db) {

        // check if server already registered
        Enumeration enumeration = db.serverTable.elements();
        while (enumeration.hasMoreElements()) {
            server = (DBServerDef) enumeration.nextElement();
            if (serverDef.applicationName.equals(server.applicationName)) {
                if (debug)
                    System.out.println(
                        "RepositoryImpl: registerServer called " +
                        "to register ServerDef " +
                        printServerDef( serverDef ) +
                        " with " + ((theServerId==illegalServerId) ?
                    "a new server Id" : ("server Id " + theServerId)) +
                                       " FAILED because it is already registered." ) ;

                throw (new ServerAlreadyRegistered(server.id));
            }
        }

        // generate a new server id
        if (theServerId == illegalServerId)
            serverId = db.incrementServerIdCounter();
        else
            serverId = theServerId;

        // add server def to the database
        server = new DBServerDef(serverDef, serverId);
        db.serverTable.put(new Integer(serverId), server);
        db.flush();

        if (debug)
            if (theServerId==illegalServerId)
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with new serverId " + serverId ) ;
            else
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with assigned serverId " + serverId ) ;

        return serverId;
    }
}
 
Example #17
Source File: RepositoryImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public int registerServer(ServerDef serverDef, int theServerId)
    throws ServerAlreadyRegistered
{
    int         serverId;
    DBServerDef server = null;

    synchronized (db) {

        // check if server already registered
        Enumeration enumeration = db.serverTable.elements();
        while (enumeration.hasMoreElements()) {
            server = (DBServerDef) enumeration.nextElement();
            if (serverDef.applicationName.equals(server.applicationName)) {
                if (debug)
                    System.out.println(
                        "RepositoryImpl: registerServer called " +
                        "to register ServerDef " +
                        printServerDef( serverDef ) +
                        " with " + ((theServerId==illegalServerId) ?
                    "a new server Id" : ("server Id " + theServerId)) +
                                       " FAILED because it is already registered." ) ;

                throw (new ServerAlreadyRegistered(server.id));
            }
        }

        // generate a new server id
        if (theServerId == illegalServerId)
            serverId = db.incrementServerIdCounter();
        else
            serverId = theServerId;

        // add server def to the database
        server = new DBServerDef(serverDef, serverId);
        db.serverTable.put(new Integer(serverId), server);
        db.flush();

        if (debug)
            if (theServerId==illegalServerId)
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with new serverId " + serverId ) ;
            else
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with assigned serverId " + serverId ) ;

        return serverId;
    }
}
 
Example #18
Source File: RepositoryImpl.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public int registerServer(ServerDef serverDef, int theServerId)
    throws ServerAlreadyRegistered
{
    int         serverId;
    DBServerDef server = null;

    synchronized (db) {

        // check if server already registered
        Enumeration enumeration = db.serverTable.elements();
        while (enumeration.hasMoreElements()) {
            server = (DBServerDef) enumeration.nextElement();
            if (serverDef.applicationName.equals(server.applicationName)) {
                if (debug)
                    System.out.println(
                        "RepositoryImpl: registerServer called " +
                        "to register ServerDef " +
                        printServerDef( serverDef ) +
                        " with " + ((theServerId==illegalServerId) ?
                    "a new server Id" : ("server Id " + theServerId)) +
                                       " FAILED because it is already registered." ) ;

                throw (new ServerAlreadyRegistered(server.id));
            }
        }

        // generate a new server id
        if (theServerId == illegalServerId)
            serverId = db.incrementServerIdCounter();
        else
            serverId = theServerId;

        // add server def to the database
        server = new DBServerDef(serverDef, serverId);
        db.serverTable.put(new Integer(serverId), server);
        db.flush();

        if (debug)
            if (theServerId==illegalServerId)
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with new serverId " + serverId ) ;
            else
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with assigned serverId " + serverId ) ;

        return serverId;
    }
}
 
Example #19
Source File: RepositoryImpl.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public int registerServer(ServerDef serverDef, int theServerId)
    throws ServerAlreadyRegistered
{
    int         serverId;
    DBServerDef server = null;

    synchronized (db) {

        // check if server already registered
        Enumeration enumeration = db.serverTable.elements();
        while (enumeration.hasMoreElements()) {
            server = (DBServerDef) enumeration.nextElement();
            if (serverDef.applicationName.equals(server.applicationName)) {
                if (debug)
                    System.out.println(
                        "RepositoryImpl: registerServer called " +
                        "to register ServerDef " +
                        printServerDef( serverDef ) +
                        " with " + ((theServerId==illegalServerId) ?
                    "a new server Id" : ("server Id " + theServerId)) +
                                       " FAILED because it is already registered." ) ;

                throw (new ServerAlreadyRegistered(server.id));
            }
        }

        // generate a new server id
        if (theServerId == illegalServerId)
            serverId = db.incrementServerIdCounter();
        else
            serverId = theServerId;

        // add server def to the database
        server = new DBServerDef(serverDef, serverId);
        db.serverTable.put(new Integer(serverId), server);
        db.flush();

        if (debug)
            if (theServerId==illegalServerId)
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with new serverId " + serverId ) ;
            else
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with assigned serverId " + serverId ) ;

        return serverId;
    }
}
 
Example #20
Source File: RepositoryImpl.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
public int registerServer(ServerDef serverDef, int theServerId)
    throws ServerAlreadyRegistered
{
    int         serverId;
    DBServerDef server = null;

    synchronized (db) {

        // check if server already registered
        Enumeration enumeration = db.serverTable.elements();
        while (enumeration.hasMoreElements()) {
            server = (DBServerDef) enumeration.nextElement();
            if (serverDef.applicationName.equals(server.applicationName)) {
                if (debug)
                    System.out.println(
                        "RepositoryImpl: registerServer called " +
                        "to register ServerDef " +
                        printServerDef( serverDef ) +
                        " with " + ((theServerId==illegalServerId) ?
                    "a new server Id" : ("server Id " + theServerId)) +
                                       " FAILED because it is already registered." ) ;

                throw (new ServerAlreadyRegistered(server.id));
            }
        }

        // generate a new server id
        if (theServerId == illegalServerId)
            serverId = db.incrementServerIdCounter();
        else
            serverId = theServerId;

        // add server def to the database
        server = new DBServerDef(serverDef, serverId);
        db.serverTable.put(new Integer(serverId), server);
        db.flush();

        if (debug)
            if (theServerId==illegalServerId)
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with new serverId " + serverId ) ;
            else
                System.out.println( "RepositoryImpl: registerServer called " +
                                    "to register ServerDef " + printServerDef( serverDef ) +
                                    " with assigned serverId " + serverId ) ;

        return serverId;
    }
}