< prev index next >
src/hotspot/share/services/attachListener.hpp
Print this page
*** 24,33 ****
--- 24,35 ----
#ifndef SHARE_SERVICES_ATTACHLISTENER_HPP
#define SHARE_SERVICES_ATTACHLISTENER_HPP
#include "memory/allocation.hpp"
+ #include "metaprogramming/isRegisteredEnum.hpp"
+ #include "runtime/atomic.hpp"
#include "utilities/debug.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/macros.hpp"
#include "utilities/ostream.hpp"
*** 47,80 ****
struct AttachOperationFunctionInfo {
const char* name;
AttachOperationFunction func;
};
class AttachListener: AllStatic {
public:
static void vm_start() NOT_SERVICES_RETURN;
static void init() NOT_SERVICES_RETURN;
static void abort() NOT_SERVICES_RETURN;
// invoke to perform clean-up tasks when all clients detach
static void detachall() NOT_SERVICES_RETURN;
// indicates if the Attach Listener needs to be created at startup
static bool init_at_startup() NOT_SERVICES_RETURN_(false);
// indicates if we have a trigger to start the Attach Listener
static bool is_init_trigger() NOT_SERVICES_RETURN_(false);
#if !INCLUDE_SERVICES
static bool is_attach_supported() { return false; }
#else
private:
! static volatile bool _initialized;
public:
! static bool is_initialized() { return _initialized; }
! static void set_initialized() { _initialized = true; }
// indicates if this VM supports attach-on-demand
static bool is_attach_supported() { return !DisableAttachMechanism; }
// platform specific initialization
--- 49,112 ----
struct AttachOperationFunctionInfo {
const char* name;
AttachOperationFunction func;
};
+ enum AttachListenerState {
+ AL_NOT_INITIALIZED,
+ AL_INITIALIZING,
+ AL_INITIALIZED
+ };
+
+ template<> struct IsRegisteredEnum<AttachListenerState> : public TrueType {};
+
class AttachListener: AllStatic {
public:
static void vm_start() NOT_SERVICES_RETURN;
static void init() NOT_SERVICES_RETURN;
static void abort() NOT_SERVICES_RETURN;
// invoke to perform clean-up tasks when all clients detach
static void detachall() NOT_SERVICES_RETURN;
+ // check unix domain socket file on filesystem
+ static bool check_socket_file() NOT_SERVICES_RETURN_(false);
+
// indicates if the Attach Listener needs to be created at startup
static bool init_at_startup() NOT_SERVICES_RETURN_(false);
// indicates if we have a trigger to start the Attach Listener
static bool is_init_trigger() NOT_SERVICES_RETURN_(false);
#if !INCLUDE_SERVICES
static bool is_attach_supported() { return false; }
#else
+
private:
! static volatile AttachListenerState _state;
public:
! static void set_state(AttachListenerState new_state) {
! Atomic::store(new_state, &_state);
! }
!
! static AttachListenerState get_state() {
! return Atomic::load(&_state);
! }
!
! static AttachListenerState transit_state(AttachListenerState new_state,
! AttachListenerState cmp_state) {
! return Atomic::cmpxchg(new_state, &_state, cmp_state);
! }
!
! static bool is_initialized() {
! return Atomic::load(&_state) == AL_INITIALIZED;
! }
!
! static void set_initialized() {
! Atomic::store(AL_INITIALIZED, &_state);
! }
// indicates if this VM supports attach-on-demand
static bool is_attach_supported() { return !DisableAttachMechanism; }
// platform specific initialization
< prev index next >