src/share/vm/services/attachListener.hpp

Print this page


   1 /*
   2  * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 







  25 // The AttachListener thread services a queue of operations that are enqueued
  26 // by client tools. Each operation is identified by a name and has up to 3
  27 // arguments. The operation name is mapped to a function which performs the
  28 // operation. The function is called with an outputStream which is can use to
  29 // write any result data (for examples the properties command serializes
  30 // properties names and values to the output stream). When the function
  31 // complets the result value and any result data is returned to the client
  32 // tool.
  33 
  34 #ifndef SERVICES_KERNEL
  35 
  36 class AttachOperation;
  37 
  38 typedef jint (*AttachOperationFunction)(AttachOperation* op, outputStream* out);
  39 
  40 struct AttachOperationFunctionInfo {
  41   const char* name;
  42   AttachOperationFunction func;
  43 };
  44 #endif // SERVICES_KERNEL


 128     if (arg == NULL) {
 129       _arg[i][0] = '\0';
 130     } else {
 131       assert(strlen(arg) <= arg_length_max, "exceeds maximum argument length");
 132       strcpy(_arg[i], arg);
 133     }
 134   }
 135 
 136   // create an operation of a given name
 137   AttachOperation(char* name) {
 138     set_name(name);
 139     for (int i=0; i<arg_count_max; i++) {
 140       set_arg(i, NULL);
 141     }
 142   }
 143 
 144   // complete operation by sending result code and any result data to the client
 145   virtual void complete(jint result, bufferedStream* result_stream) = 0;
 146 };
 147 #endif // SERVICES_KERNEL


   1 /*
   2  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_SERVICES_ATTACHLISTENER_HPP
  26 #define SHARE_VM_SERVICES_ATTACHLISTENER_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "utilities/debug.hpp"
  30 #include "utilities/ostream.hpp"
  31 
  32 // The AttachListener thread services a queue of operations that are enqueued
  33 // by client tools. Each operation is identified by a name and has up to 3
  34 // arguments. The operation name is mapped to a function which performs the
  35 // operation. The function is called with an outputStream which is can use to
  36 // write any result data (for examples the properties command serializes
  37 // properties names and values to the output stream). When the function
  38 // complets the result value and any result data is returned to the client
  39 // tool.
  40 
  41 #ifndef SERVICES_KERNEL
  42 
  43 class AttachOperation;
  44 
  45 typedef jint (*AttachOperationFunction)(AttachOperation* op, outputStream* out);
  46 
  47 struct AttachOperationFunctionInfo {
  48   const char* name;
  49   AttachOperationFunction func;
  50 };
  51 #endif // SERVICES_KERNEL


 135     if (arg == NULL) {
 136       _arg[i][0] = '\0';
 137     } else {
 138       assert(strlen(arg) <= arg_length_max, "exceeds maximum argument length");
 139       strcpy(_arg[i], arg);
 140     }
 141   }
 142 
 143   // create an operation of a given name
 144   AttachOperation(char* name) {
 145     set_name(name);
 146     for (int i=0; i<arg_count_max; i++) {
 147       set_arg(i, NULL);
 148     }
 149   }
 150 
 151   // complete operation by sending result code and any result data to the client
 152   virtual void complete(jint result, bufferedStream* result_stream) = 0;
 153 };
 154 #endif // SERVICES_KERNEL
 155 
 156 #endif // SHARE_VM_SERVICES_ATTACHLISTENER_HPP