src/share/vm/services/attachListener.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 80060074 Sdiff src/share/vm/services

src/share/vm/services/attachListener.cpp

Print this page




 331       return JNI_ERR;
 332     }
 333   }
 334   bool res = CommandLineFlags::size_tAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
 335   if (! res) {
 336     out->print_cr("setting flag %s failed", name);
 337   }
 338 
 339   return res? JNI_OK : JNI_ERR;
 340 }
 341 
 342 // set a string global flag using value from AttachOperation
 343 static jint set_ccstr_flag(const char* name, AttachOperation* op, outputStream* out) {
 344   const char* value;
 345   if ((value = op->arg(1)) == NULL) {
 346     out->print_cr("flag value must be a string");
 347     return JNI_ERR;
 348   }
 349   bool res = CommandLineFlags::ccstrAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
 350   if (res) {
 351     FREE_C_HEAP_ARRAY(char, value, mtInternal);
 352   } else {
 353     out->print_cr("setting flag %s failed", name);
 354   }
 355 
 356   return res? JNI_OK : JNI_ERR;
 357 }
 358 
 359 // Implementation of "setflag" command
 360 static jint set_flag(AttachOperation* op, outputStream* out) {
 361 
 362   const char* name = NULL;
 363   if ((name = op->arg(0)) == NULL) {
 364     out->print_cr("flag name is missing");
 365     return JNI_ERR;
 366   }
 367 
 368   Flag* f = Flag::find_flag((char*)name, strlen(name));
 369   if (f && f->is_external() && f->is_writeable()) {
 370     if (f->is_bool()) {
 371       return set_bool_flag(name, op, out);




 331       return JNI_ERR;
 332     }
 333   }
 334   bool res = CommandLineFlags::size_tAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
 335   if (! res) {
 336     out->print_cr("setting flag %s failed", name);
 337   }
 338 
 339   return res? JNI_OK : JNI_ERR;
 340 }
 341 
 342 // set a string global flag using value from AttachOperation
 343 static jint set_ccstr_flag(const char* name, AttachOperation* op, outputStream* out) {
 344   const char* value;
 345   if ((value = op->arg(1)) == NULL) {
 346     out->print_cr("flag value must be a string");
 347     return JNI_ERR;
 348   }
 349   bool res = CommandLineFlags::ccstrAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
 350   if (res) {
 351     FREE_C_HEAP_ARRAY(char, value);
 352   } else {
 353     out->print_cr("setting flag %s failed", name);
 354   }
 355 
 356   return res? JNI_OK : JNI_ERR;
 357 }
 358 
 359 // Implementation of "setflag" command
 360 static jint set_flag(AttachOperation* op, outputStream* out) {
 361 
 362   const char* name = NULL;
 363   if ((name = op->arg(0)) == NULL) {
 364     out->print_cr("flag name is missing");
 365     return JNI_ERR;
 366   }
 367 
 368   Flag* f = Flag::find_flag((char*)name, strlen(name));
 369   if (f && f->is_external() && f->is_writeable()) {
 370     if (f->is_bool()) {
 371       return set_bool_flag(name, op, out);


src/share/vm/services/attachListener.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File