src/share/vm/services/attachListener.cpp

Print this page




 140   VM_PrintThreads op1(out, print_concurrent_locks);
 141   VMThread::execute(&op1);
 142 
 143   // JNI global handles
 144   VM_PrintJNI op2(out);
 145   VMThread::execute(&op2);
 146 
 147   // Deadlock detection
 148   VM_FindDeadlocks op3(out);
 149   VMThread::execute(&op3);
 150 
 151   return JNI_OK;
 152 }
 153 
 154 // A jcmd attach operation request was received, which will now
 155 // dispatch to the diagnostic commands used for serviceability functions.
 156 static jint jcmd(AttachOperation* op, outputStream* out) {
 157   Thread* THREAD = Thread::current();
 158   // All the supplied jcmd arguments are stored as a single
 159   // string (op->arg(0)). This is parsed by the Dcmd framework.
 160   DCmd::parse_and_execute(out, op->arg(0), ' ', THREAD);
 161   if (HAS_PENDING_EXCEPTION) {
 162     java_lang_Throwable::print(PENDING_EXCEPTION, out);
 163     out->cr();
 164     CLEAR_PENDING_EXCEPTION;
 165     // The exception has been printed on the output stream
 166     // If the JVM returns JNI_ERR, the attachAPI throws a generic I/O
 167     // exception and the content of the output stream is not processed.
 168     // By returning JNI_OK, the exception will be displayed on the client side
 169   }
 170   return JNI_OK;
 171 }
 172 
 173 #ifndef SERVICES_KERNEL   // Heap dumping not supported
 174 // Implementation of "dumpheap" command.
 175 // See also: HeapDumpDCmd class
 176 //
 177 // Input arguments :-
 178 //   arg0: Name of the dump file
 179 //   arg1: "-live" or "-all"
 180 jint dump_heap(AttachOperation* op, outputStream* out) {




 140   VM_PrintThreads op1(out, print_concurrent_locks);
 141   VMThread::execute(&op1);
 142 
 143   // JNI global handles
 144   VM_PrintJNI op2(out);
 145   VMThread::execute(&op2);
 146 
 147   // Deadlock detection
 148   VM_FindDeadlocks op3(out);
 149   VMThread::execute(&op3);
 150 
 151   return JNI_OK;
 152 }
 153 
 154 // A jcmd attach operation request was received, which will now
 155 // dispatch to the diagnostic commands used for serviceability functions.
 156 static jint jcmd(AttachOperation* op, outputStream* out) {
 157   Thread* THREAD = Thread::current();
 158   // All the supplied jcmd arguments are stored as a single
 159   // string (op->arg(0)). This is parsed by the Dcmd framework.
 160   DCmd::parse_and_execute(DCmd_Source_AttachAPI, out, op->arg(0), ' ', THREAD);
 161   if (HAS_PENDING_EXCEPTION) {
 162     java_lang_Throwable::print(PENDING_EXCEPTION, out);
 163     out->cr();
 164     CLEAR_PENDING_EXCEPTION;
 165     // The exception has been printed on the output stream
 166     // If the JVM returns JNI_ERR, the attachAPI throws a generic I/O
 167     // exception and the content of the output stream is not processed.
 168     // By returning JNI_OK, the exception will be displayed on the client side
 169   }
 170   return JNI_OK;
 171 }
 172 
 173 #ifndef SERVICES_KERNEL   // Heap dumping not supported
 174 // Implementation of "dumpheap" command.
 175 // See also: HeapDumpDCmd class
 176 //
 177 // Input arguments :-
 178 //   arg0: Name of the dump file
 179 //   arg1: "-live" or "-all"
 180 jint dump_heap(AttachOperation* op, outputStream* out) {