jadex.bridge.service.search.SServiceProvider.getServiceUpwards()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中jadex.bridge.service.search.SServiceProvider.getServiceUpwards()方法的一些代码示例,展示了SServiceProvider.getServiceUpwards()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SServiceProvider.getServiceUpwards()方法的具体详情如下:
包路径:jadex.bridge.service.search.SServiceProvider
类名称:SServiceProvider
方法名:getServiceUpwards

SServiceProvider.getServiceUpwards介绍

[英]Get one service of a type and only search upwards (parents).
[中]获取一种类型的服务,只向上搜索(父级)。

代码示例

代码示例来源:origin: net.sourceforge.jadex/jadex-bridge

/**
   *  Start the service.
   *  @return A future that is done when the service has completed starting.  
   */
  public IFuture<Void> start()
  {
    final Future<Void> ret = new Future<Void>();
    
//        System.out.println("search clock: "+getId());
    SServiceProvider.getServiceUpwards(ComponentServiceContainer.this, IComponentManagementService.class)
      .addResultListener(new ExceptionDelegationResultListener<IComponentManagementService, Void>(ret)
    {
      public void customResultAvailable(IComponentManagementService result)
      {
        cms = result;
//                System.out.println("Has cms: "+getId()+" "+cms);
        
        // Services may need other services and thus need to be able to search
        // the container.
        ComponentServiceContainer.super.start().addResultListener(new DelegationResultListener<Void>(ret));
      }
    });
    
    return ret;
  }

代码示例来源:origin: net.sourceforge.jadex/jadex-bridge

SServiceProvider.getServiceUpwards(provider, IComponentManagementService.class)
  .addResultListener(new ExceptionDelegationResultListener<IComponentManagementService, T>(ret)

代码示例来源:origin: net.sourceforge.jadex/jadex-platform-base

/**
   *  Get the (cached) cms.
   */
  protected IFuture<IComponentManagementService> getCMS()
  {
    // Change comments below to test performance of cached cms vs. direct access.
    if(getServiceContainer()==null)
    {
      System.out.println("container is null: "+component+", "+getComponentIdentifier());
    }
//        return SServiceProvider.getServiceUpwards(getServiceContainer(), IComponentManagementService.class);
    if(cms==null || cms.getException()!=null)
    {
      cms    = SServiceProvider.getServiceUpwards(getServiceContainer(), IComponentManagementService.class);
    }
    return cms;
  }

代码示例来源:origin: net.sourceforge.jadex/jadex-bridge

SServiceProvider.getServiceUpwards(provider, IComponentManagementService.class)
  .addResultListener(new ExceptionDelegationResultListener<IComponentManagementService, T>(ret)

代码示例来源:origin: net.sourceforge.jadex/jadex-platform

SServiceProvider.getServiceUpwards(provider, IThreadPoolService.class)
  .addResultListener(new DelegationResultListener(ret)

代码示例来源:origin: net.sourceforge.jadex/jadex-applications-bpmn

/**
 *  Execute the task.
 */
public IFuture<Void> execute(final ITaskContext context, final IInternalAccess process)
{
  final Future<Void> ret = new Future<Void>();
  IFuture<IClockService> clockfut    = SServiceProvider.getServiceUpwards(process.getServiceContainer(), IClockService.class);
  clockfut.addResultListener(new IResultListener<IClockService>()
  {
    public void resultAvailable(final IClockService	clock)
    {
      ((BpmnInterpreter) process).getComponentAdapter().invokeLater(new Runnable()
      {
        public void run()
        {
          context.setParameterValue("time", Long.valueOf(clock.getTime()));
          ret.setResult(null);
        }
      });
    }
    
    public void exceptionOccurred(Exception exception)
    {
      ret.setException(exception);
    }
  });
  return ret;
}

代码示例来源:origin: net.sourceforge.jadex/jadex-platform-base

SServiceProvider.getServiceUpwards(getServiceContainer(), IComponentManagementService.class)
  .addResultListener(new ExceptionDelegationResultListener<IComponentManagementService, Collection<IExternalAccess>>(ret)

代码示例来源:origin: net.sourceforge.jadex/jadex-platform

SServiceProvider.getServiceUpwards(component.getServiceContainer(), IComponentManagementService.class)
  .addResultListener(new ExceptionDelegationResultListener<IComponentManagementService, Collection<IExternalAccess>>(ret)

代码示例来源:origin: net.sourceforge.jadex/jadex-platform

cms    = SServiceProvider.getServiceUpwards(getServiceContainer(), IComponentManagementService.class);
cms.addResultListener(new IResultListener<IComponentManagementService>()

代码示例来源:origin: net.sourceforge.jadex/jadex-platform-base

SServiceProvider.getServiceUpwards(access.getServiceContainer(), IThreadPoolService.class)
  .addResultListener(access.createResultListener(new DelegationResultListener(fut)

代码示例来源:origin: net.sourceforge.jadex/jadex-tools-base-swing

SServiceProvider.getServiceUpwards(jcc.getJCCAccess().getServiceProvider(), IComponentManagementService.class)
  .addResultListener(new ExceptionDelegationResultListener<IComponentManagementService, ClassLoader>(ret)

代码示例来源:origin: net.sourceforge.jadex/jadex-tools-base-swing

/**
   *  Get the thread pool.
   */
  protected IFuture<IThreadPool> getThreadPool()
  {
    final Future<IThreadPool> ret = new  Future<IThreadPool>();
    
    if(tp==null)
    {
//            SServiceProvider.getServiceUpwards(treepanel.localexta.getServiceProvider(), IDaemonThreadPoolService.class)
      SServiceProvider.getServiceUpwards(treepanel.getGUIExternalAccess().getServiceProvider(), IDaemonThreadPoolService.class)
        .addResultListener(new SwingDefaultResultListener<IDaemonThreadPoolService>()
      {
        public void customResultAvailable(IDaemonThreadPoolService result)
        {
          tp = result;
          ret.setResult(tp);
        }
      });
    }
    else
    {
      ret.setResult(tp);
    }
    
    return ret;
  }

代码示例来源:origin: net.sourceforge.jadex/jadex-runtimetools-swing

/**
 *  Get the thread pool.
 */
protected IFuture<IThreadPool> getThreadPool()
{
  final Future<IThreadPool> ret = new  Future<IThreadPool>();
  
  if(tp==null)
  {
    SServiceProvider.getServiceUpwards(jcc.getJCCAccess().getServiceProvider(), IDaemonThreadPoolService.class)
      .addResultListener(new SwingDefaultResultListener<IDaemonThreadPoolService>()
    {
      public void customResultAvailable(IDaemonThreadPoolService result)
      {
        tp = result;
        ret.setResult(tp);
      }
    });
  }
  else
  {
    ret.setResult(tp);
  }
  
  return ret;
}

代码示例来源:origin: net.sourceforge.jadex/jadex-platform-base

SServiceProvider.getServiceUpwards(agent.getServiceProvider(), IMessageService.class)
  .addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<IMessageService, Void>(ret)

代码示例来源:origin: net.sourceforge.jadex/jadex-kernel-base

SServiceProvider.getServiceUpwards(getServiceContainer(), IComponentManagementService.class)
  .addResultListener(createResultListener(new ExceptionDelegationResultListener<IComponentManagementService, IComponentIdentifier>(ret)

代码示例来源:origin: net.sourceforge.jadex/jadex-bridge

/**
   * 
   */
  public static void main(String[] args)
  {
    String[]    pargs    = new String[]
    {
      "-gui", "false"
    };
    IExternalAccess    rootcomp    = (IExternalAccess)Starter.createPlatform(pargs).get(new ThreadSuspendable());
    IComponentManagementService cms = (IComponentManagementService)SServiceProvider.getServiceUpwards(rootcomp.getServiceProvider(), IComponentManagementService.class).get(new ThreadSuspendable());
    dorun(cms, "jadex/micro/testcases/blocking/ShutdownAgent.class");
//        dorun(cms, "jadex/micro/benchmarks/MessagePerformanceAgent.class");
//        dorun(cms, "jadex/micro/examples/ping/PingScenario.application.xml");
  }
}

代码示例来源:origin: net.sourceforge.jadex/jadex-platform

SServiceProvider.getServiceUpwards(agent.getServiceProvider(), IMessageService.class)
  .addResultListener(agent.createResultListener(new ExceptionDelegationResultListener<IMessageService, Void>(ret)

代码示例来源:origin: net.sourceforge.jadex/jadex-platform-standalone

public void customResultAvailable(Object result)
  SServiceProvider.getServiceUpwards(provider, IComponentManagementService.class)
    .addResultListener(new DelegationResultListener(ret)

代码示例来源:origin: net.sourceforge.jadex/jadex-kernel-base

ConfigurationInfo conf = model.getConfiguration(config);
final ComponentInstanceInfo[] components = conf.getComponentInstances();
SServiceProvider.getServiceUpwards(getServiceContainer(), IComponentManagementService.class)
  .addResultListener(createResultListener(new ExceptionDelegationResultListener<IComponentManagementService, Void>(ret)

代码示例来源:origin: net.sourceforge.jadex/jadex-bridge

/**
 *  Get one service of a type and only search upwards (parents).
 *  @param type The class.
 *  @return The corresponding service.
 */
public <T> IFuture<T> searchServiceUpwards(final Class<T> type)
{
  if(shutdowned)
  {
    return new Future<T>(new ComponentTerminatedException(id));
  }
  final Future<T>	fut	= new Future<T>();
  SServiceProvider.getServiceUpwards(this, type).addResultListener(new DelegationResultListener(fut)
  {
    public void customResultAvailable(Object result)
    {
      if(shutdowned)
      {
        fut.setException(new ComponentTerminatedException(id));
      }
      else
      {
        fut.setResult((T)BasicServiceInvocationHandler.createRequiredServiceProxy(instance, 
          instance.getExternalAccess(), adapter, (IService)result, null, new RequiredServiceInfo(type), null, realtime));
      }
    }
  });
  return (IFuture<T>)FutureFunctionality.getDelegationFuture(fut, new ComponentFutureFunctionality(instance.getExternalAccess(), adapter));
}

相关文章