Package net.jini.core.lookup

Examples of net.jini.core.lookup.ServiceItem


        System.out.println("Actors-Servers Map:");

        for (Iterator keysIterator = actorsThreadsMap.keySet().iterator(); keysIterator
                .hasNext();) {
            ComponentEntity actor = (ComponentEntity) keysIterator.next();
            ServiceItem server = ((ClientThread) actorsThreadsMap.get(actor))
                    .getService();
            System.out.println(server.serviceID.toString() + "\t <--- "
                    + actor.getFullName());
        }
    }
View Full Code Here


    protected BuildAgentService pickAgent() throws CruiseControlException {
        BuildAgentService agent = null;

        while (agent == null) {
            final ServiceItem serviceItem;
            try {
                serviceItem = getDiscovery().findMatchingService();
            } catch (RemoteException e) {
                throw new CruiseControlException("Error finding matching agent.", e);
            }
View Full Code Here

    public ServiceItem findMatchingService() throws RemoteException {
        return findMatchingService(true);
    }
    public ServiceItem findMatchingService(final boolean doClaim) throws RemoteException {
        final ServiceItem result = getLookupCache().lookup(FLTR_AVAILABLE);
        if (doClaim && result != null) {
            ((BuildAgentService) result.service).claim();
        }
        return result;
    }
View Full Code Here

        }

        private String buildDiscoveryMsg(final ServiceDiscoveryEvent event, final String actionName) {
            String msg = "\nService " + actionName + ": ";

            final ServiceItem postItem = event.getPostEventServiceItem();
            if (postItem != null) {
                msg = toStringServiceItem(postItem, msg + "PostEvent: ");
            } else {
                final ServiceItem preItem = event.getPreEventServiceItem();
                if (preItem != null) {
                    msg = toStringServiceItem(preItem, msg + "PreEvent: ");
                } else {
                    msg += "NOT SURE WHAT THIS EVENT IS!!!";
                }
View Full Code Here

            for (int i = 0; i < serviceItems.length; i++) {
                lstServiceItems.add(serviceItems[i]);
            }

            result.append("Found: " + serviceItems.length + " agents.\n");
            ServiceItem serviceItem;
            BuildAgentService agent;
            String agentInfo;
            for (int x = 0; x < serviceItems.length; x++) {
                serviceItem = serviceItems[x];
                agent = (BuildAgentService) serviceItem.service;
View Full Code Here

    public static void main (String[] args) {
        RoomLight myServer;
        LookupLocator lookup;
        ServiceRegistrar registrar;
        ServiceItem serviceItem;

        try {
/*        Set the security manager to allow the RMI class loader
          to go to the codebase for classes that are not available
          locally.  */

        System.setSecurityManager (new RMISecurityManager ());

/*      Create the attributes (an array of entry objects) that describe this
        server and use it to register this server with the lookup service.
        JoinManager finds and registers with the lookup service */

        Entry[] attr = new Entry[2];
        attr[0] = new Name("Neon Light");
        attr[1] = new ServiceInfo("Name", "Manufactor", "vendor","version","model","serial");
        myServer = new RoomLightNeon ();
        serviceItem = new ServiceItem(null, myServer, attr);

        lookup = new LookupLocator ("jini://localhost");
        registrar  = lookup.getRegistrar();
        registrar.register(serviceItem, Lease.FOREVER);

View Full Code Here

                            return;
                        }//endif
                        itemReg = new ServiceItemReg( reg.proxy, srvcItem );
                        serviceIdMap.put( thisTaskSid, itemReg );
                    }//end sync(serviceIdMap)
                    ServiceItem newFilteredItem =
                                  filterMaybeDiscard(srvcItem,reg.proxy,false);
                    if(newFilteredItem != null) {
                        addServiceNotify(newFilteredItem);
                    }//endif
                }//endif
View Full Code Here

            }//end constructor

            public void run() {
                logger.finest("ServiceDiscoveryManager - UnmapProxyTask "
                              +"started");
                ServiceItem item = null;
                synchronized(itemReg) {
                    itemReg.removeProxy(reg.proxy);//disassociate the LUS
                    if( itemReg.hasNoProxys() ) {//no more LUSs, remove map
                        item = itemReg.filteredItem;
                    }//endif
View Full Code Here

        } else {
            attrSets = (Entry[])attrSets.clone();
            LookupAttributes.check(attrSets,false);//null elements NOT ok
            lookupAttr = attrSets;
        }//endif
  serviceItem = new ServiceItem(serviceID, serviceProxy, lookupAttr);
        /* Lease renewal manager */
        leaseRenewalMgr = leaseMgr;
  if(leaseRenewalMgr == null) {
            try {
                leaseRenewalMgr = (LeaseRenewalManager)config.getEntry
View Full Code Here

         *  send to that listener a notification containing the service's ID.
         */
        public void register(Entry[] srvcAttrs) throws Exception {
            if(proxy == null) throw new RuntimeException("proxy is null");
            /* The lookup service proxy was already prepared at discovery */
            ServiceItem tmpSrvcItem = null;
            synchronized(joinSet) {
                srvcRegistration = null;
                synchronized(serviceItem) {//accessing serviceItem.serviceID
                    tmpSrvcItem = new ServiceItem(serviceItem.serviceID,
                                                  serviceItem.service,
                                                  srvcAttrs);
                }//end sync(serviceItem)
            }//end sync(joinSet)
            /* Retrieve and prepare the proxy to the service registration */
 
View Full Code Here

TOP

Related Classes of net.jini.core.lookup.ServiceItem

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.