Examples of HostId


Examples of net.sf.agentopia.util.net.HostId

        // Set new marketplace.
        this.marketPlace = marketPlace;
        this.marketPlaceForAgents = new MarketPlaceForAgentsProxy(marketPlace);

        // Add host id of market place to waylist.
        final HostId hostId = this.marketPlace.getHomeId();
        placeList.add(hostId);

        // Write only if not at startup - at startup setMarketPlace() occurs
        // before home token is set, so the isHome() in writeHome() will fail.
        // Sorry for that quickhack here, but no other choice.
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

     */
    protected boolean isKnownHost() {
        if (null == marketPlace) {
            return false;
        }
        HostId currentId = getMarketPlace().getHomeId(), placeId;
        // The last one does not count.
        // Could have been introduced by setMarketPlace().
        final int hostCount = placeList.size() - 1;
        for (int pos = 0; pos < hostCount; pos++) {
            placeId = placeList.get(pos);
            if (currentId.equals(placeId)) {
                return true;
            }
        }
        // Nothing found, so we havent been here before.
        return false;
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

        if (-1 != placePos && placePos > 1) {
            // Should always be found because setMarketPlace() automatically
            // adds this one to the places.
            // If the position is 0 it means we are home, if it is 1 it means
            // we are the last station before home.
            final HostId lastHostId = placeList.get(placePos - 1);

            // So this is one station before.
            // Try to get there per sustainer or, if impossible, per
            // communicator.
            try {
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

        }
        try {
            PrivilegedExceptionAction<IAgentopiaConnection> exceptionAction = new PrivilegedExceptionAction<IAgentopiaConnection>() {

                public IAgentopiaConnection run() throws Exception {
                    final HostId innerTargetId = targetId;
                    final int innerFirstIntMessage = firstIntMessage;
                    return marketPlace.createConnection(innerTargetId, innerFirstIntMessage);
                }

            };
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

     * @see junit.framework.TestCase#setUp()
     */
    @Override
    protected void setUp() throws Exception {
        // Create a new test box and connect to all servers.
        testBox = new TestBox(new HostId("ginko.vpn:15900"));
        for (String serverId : servers) {
            final HostId hostId = new HostId(serverId);
            testBox.connectToNetwork(hostId);
        }

        // Check that the home id is stringent.
        final HostId homeId = testBox.getHomeId();
        assertNotSame("localhost", homeId.getHostBasicName());
    }
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

    /**
     * @see junit.framework.TestCase#setUp()
     */
    @Override
    protected void setUp() throws Exception {
        testBox = new TestBox(new HostId("ginko.vpn:15900"));
        testBox.connectToNetwork(new HostId("ginko.vpn:15907"));
        testBox.connectToNetwork(new HostId("eva.vpn:15907"));
    }
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

    /**
     * @return An example host name, as probable exit.
     */
    private String getExampleHostName() {
        final HostId homeId = controller.getHost().getHomeId();
        StringBuilder buf = new StringBuilder(1024);
        // buf.append("e.g. ");
        buf.append(homeId.getHostBasicName());
        buf.append(':');
        buf.append(homeId.getPort() + 1);
        return buf.toString();
    }
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

     * @param isAutomaticMarketPlaceStart Whether to start the market place
     *        automatically (use false e.g. for autotests).
     */
    public Host(int port, boolean isAutomaticMarketPlaceStart) {
        try {
            HostId hostId = new HostId(port);
            init(hostId, isAutomaticMarketPlaceStart);
        }
        catch (IOException exc) {
            Logger.getLogger().warn(exc, "Server FATAL: Can not create host on port " + port + ".");
            System.exit(1);
View Full Code Here

Examples of net.sf.agentopia.util.net.HostId

     * @param dataOut The master output stream.
     * @throws IOException If I/O failed.
     */
    private Sustainer(IMarketPlace marketPlace, int port, Socket clientSocket, DataInputStream dataIn, DataOutputStream dataOut) throws IOException {
        this.marketPlace = marketPlace;
        this.targetId = new HostId(port, clientSocket.getInetAddress());
        this.clientSocket = clientSocket;
        this.dataIn = dataIn;
        this.dataOut = dataOut;
        this.isActiveSustainer = false;
        setName("Sustainer (Passive)");
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.