我有一个应用程序,在我添加/升级一些依赖项后没有启动.它记录错误说
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
我看到了所有日志文件和catalina.,localhost.,application.*,但它们似乎都没有堆栈跟踪,因为启动正在破坏.
这是tomcat8,java8.
如何检查日志以及日志在正常tomcat文件夹之外的位置.
Catalina日志:
Feb 06, 2018 3:07:32 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [
/user/name/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
Feb 06, 2018 3:07:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-7060"]
Feb 06, 2018 3:07:32 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for …
我已经看到了以下代码,我认为在addElement方法的实现中有一个无用的while循环.它应该永远不会出现比size + 1更多的元素,因为已经存在写锁定.那么为什么addElement方法删除元素直到它得到这个条件为真
while(concurrentLinkedQueue.size() >=maxSize)
Run Code Online (Sandbox Code Playgroud)
围绕这个的任何指针都会很棒.
这是实施:
public class LRUCache<K,V> {
private ConcurrentLinkedQueue<K> concurrentLinkedQueue = new ConcurrentLinkedQueue<K>();
private ConcurrentHashMap<K,V> concurrentHashMap = new ConcurrentHashMap<K, V>();
private ReadWriteLock readWriteLock = new ReentrantReadWriteLock();
private Lock readLock = readWriteLock.readLock();
private Lock writeLock = readWriteLock.writeLock();
int maxSize=0;
public LRUCache(final int MAX_SIZE){
this.maxSize=MAX_SIZE;
}
public V getElement(K key){
readLock.lock();
try {
V v=null;
if(concurrentHashMap.contains(key)){
concurrentLinkedQueue.remove(key);
v= concurrentHashMap.get(key);
concurrentLinkedQueue.add(key);
}
return v;
}finally{
readLock.unlock();
}
}
public V removeElement(K key){
writeLock.lock();
try {
V v=null;
if(concurrentHashMap.contains(key)){
v=concurrentHashMap.remove(key); …
Run Code Online (Sandbox Code Playgroud) 我正在开发一个Android应用程序,我需要从服务器安全地获取一些数据,确保没有人可以访问除应用程序和服务器之外的数据.
为此,我计划使用公钥/私钥加密.这是正确的方法,还是有更好的方法?
我是android和加密的新手.关于如何实现这一点的任何指示我可以获得一些细节/示例.
谢谢
编辑:我还计划使用私钥进行加密,使用公钥进行解密,这不是惯例.有什么问题吗?
我有一张图片:PNG image data, 403 x 343, 8-bit colormap, non-interlaced
.我想将其转换为Google Play图标大小:32-bit with alpha.
我该怎么做?
java ×2
android ×1
caching ×1
concurrency ×1
encryption ×1
google-play ×1
image ×1
imagemagick ×1
lru ×1
png ×1
tomcat ×1