jadex.commons.collection.LRU.setCleaner()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(138)

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

LRU.setCleaner介绍

[英]Set the cleaner object.
[中]设置清理器对象。

代码示例

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

/**
 *  Init the transport.
 *  @param platform The platform.
 *  @param settings The settings.
 */
public TCPTransport(final IServiceProvider container, int port, final boolean async)
{
  this.logger = Logger.getLogger(AbstractComponentAdapter.getLoggerName(container.getId())+".TCPTransport");
  
  this.container = container;
  this.async = async;
  this.port = port;
  
  // Set up sending side.
  this.connections = SCollection.createLRU(MAX_CONNECTIONS);
  ((LRU<String, Object>)this.connections).setCleaner(new ILRUEntryCleaner<String, Object>()
  {
    public void cleanupEldestEntry(Entry<String, Object> eldest)
    {
      Object con = eldest.getValue();
      if(con instanceof TCPOutputConnection)
      {
        ((TCPOutputConnection)con).close();
      }
    }
  });
  this.connections = Collections.synchronizedMap(this.connections);
}

代码示例来源:origin: org.activecomponents.jadex/jadex-platform

/**
 *  Init the transport.
 *  @param component The platform component.
 *  @param port The port.
 *  @param async true for async mode.
 */
public TCPTransport(final IInternalAccess component, int port, final boolean async)
{
  this.logger = Logger.getLogger(PlatformComponent.getLoggerName(component.getComponentIdentifier())+".TCPTransport");
  
  this.component = component;
  this.async = async;
  this.port = port;
  
  // Set up sending side.
  this.connections = SCollection.createLRU(MAX_CONNECTIONS);
  ((LRU<String, Object>)this.connections).setCleaner(new ILRUEntryCleaner<String, Object>()
  {
    public void cleanupEldestEntry(Entry<String, Object> eldest)
    {
      Object con = eldest.getValue();
      if(con instanceof TCPOutputConnection)
      {
        ((TCPOutputConnection)con).close();
      }
    }
  });
  this.connections = Collections.synchronizedMap(this.connections);
}

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

/**
 *  Init the transport.
 *  @param platform The platform.
 *  @param settings The settings.
 */
public TCPTransport(final IServiceProvider container, int port, final boolean async)
{
  this.logger = Logger.getLogger(AbstractComponentAdapter.getLoggerName(container.getId())+".TCPTransport");
  
  this.container = container;
  this.async = async;
  this.port = port;
  
  // Set up sending side.
  this.connections = SCollection.createLRU(MAX_CONNECTIONS);
  ((LRU<String, Object>)this.connections).setCleaner(new ILRUEntryCleaner<String, Object>()
  {
    public void cleanupEldestEntry(Entry<String, Object> eldest)
    {
      Object con = eldest.getValue();
      if(con instanceof TCPOutputConnection)
      {
        ((TCPOutputConnection)con).close();
      }
    }
  });
  this.connections = Collections.synchronizedMap(this.connections);
}

代码示例来源:origin: org.activecomponents.jadex/jadex-commons

if (cleaner != null)
  ((LRU) ret).setCleaner((ILRUEntryCleaner) traverser.doTraverse(cleaner, cleaner.getClass(), traversed, processors, clone, targetcl, context));

代码示例来源:origin: org.activecomponents.jadex/jadex-commons

/**
 *  Decodes and adds sub-objects during decoding.
 *  
 *  @param object The instantiated object.
 *  @param clazz The class of the object.
 *  @param context The decoding context.
 *  @return The finished object.
 */
public Object decodeSubObjects(Object object, Class<?> clazz, IDecodingContext context)
{
  LRU ret = (LRU) object;
  
  int maxentries = (int) context.readVarInt();
  ret.setMaxEntries(maxentries);
  
  ILRUEntryCleaner cleaner = (ILRUEntryCleaner) BinarySerializer.decodeObject(context);
  ret.setCleaner(cleaner);
  
  int size = (int) context.readVarInt();
  for (int i = 0; i < size; ++i)
  {
    Object key = BinarySerializer.decodeObject(context);
    Object value = BinarySerializer.decodeObject(context);
    ret.put(key, value);
  }
  
  return ret;
}

代码示例来源:origin: org.activecomponents.jadex/jadex-json

ret.setCleaner((ILRUEntryCleaner)cl);

相关文章