本文整理了Java中jadex.commons.collection.LRU.setCleaner()
方法的一些代码示例,展示了LRU.setCleaner()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LRU.setCleaner()
方法的具体详情如下:
包路径:jadex.commons.collection.LRU
类名称: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);
内容来源于网络,如有侵权,请联系作者删除!