62,625
社区成员
发帖
与我相关
我的任务
分享
String readLine(boolean ignoreLF) throws IOException {
StringBuffer s = null;
int startChar;
synchronized (lock) {
ensureOpen();
boolean omitLF = ignoreLF || skipLF;
bufferLoop:
for (;;) {
//...省略
}
}
public FileChannel getChannel() {
synchronized (this) {
if (channel == null) {
channel = FileChannelImpl.open(fd, path, true, false, this);
}
return channel;
}
}
public String readFileByLines(String fileName) {
File file = new File(fileName);
BufferedReader reader = null;
try {
FileInputStream f=null;
// System.out.println("以行为单位读取文件内容,一次读一整行:");
reader = new BufferedReader(new FileReader(file));
String tempString;
String mess="";
// 一次读入一行,直到读入null为文件结束
while ((tempString = reader.readLine()) != null) {
mess+=tempString;
}
reader.close();
return mess;
} catch (IOException e) {
return "read file error";
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e1) {
}
}
}
}
Thread Execution Information:
-----------------------
Thread "http-thread-pool-8080(98)" thread-id: 837 thread-state: TIMED_WAITING Waiting on lock: java.lang.Object@583dadc8
at: java.lang.Object.wait(Native Method)
at: com.sun.grizzly.util.SyncThreadPool$SyncThreadWorker.getTask(SyncThreadPool.java:374)
at: com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:524)
at: com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at: java.lang.Thread.run(Thread.java:745)
Thread Synchronization Statistics:
-----------------------
Number of times this thread was blocked (to enter/reenter a Monitor): 4,582
Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 4,522
Total CPU time for this thread: 1 seconds 189,494,744 nanoseconds.
User-level CPU time for this thread: 1 seconds 189,494,744 nanoseconds.
Object Monitors currently held or requested by this thread: []
Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: []
--------------------------------------------------------------------------------
Thread Execution Information:
-----------------------
Thread "http-thread-pool-8080(97)" thread-id: 836 thread-state: TIMED_WAITING Waiting on lock: java.lang.Object@583dadc8
at: java.lang.Object.wait(Native Method)
at: com.sun.grizzly.util.SyncThreadPool$SyncThreadWorker.getTask(SyncThreadPool.java:374)
at: com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:524)
at: com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at: java.lang.Thread.run(Thread.java:745)
Thread Synchronization Statistics:
-----------------------
Number of times this thread was blocked (to enter/reenter a Monitor): 4,585
Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 4,523
Total CPU time for this thread: 1 seconds 194,873,842 nanoseconds.
User-level CPU time for this thread: 1 seconds 194,873,842 nanoseconds.
Object Monitors currently held or requested by this thread: []
Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: []
--------------------------------------------------------------------------------
Thread Execution Information:
-----------------------
Thread "http-thread-pool-8080(96)" thread-id: 835 thread-state: TIMED_WAITING Waiting on lock: java.lang.Object@583dadc8
at: java.lang.Object.wait(Native Method)
at: com.sun.grizzly.util.SyncThreadPool$SyncThreadWorker.getTask(SyncThreadPool.java:374)
at: com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:524)
at: com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at: java.lang.Thread.run(Thread.java:745)
Thread Synchronization Statistics: