Codemesh Runtime v3 C++ API Reference  3.9.205
xmog_jvm_loader.h
1 //
2 // Copyright (c) 1999-2020 by Codemesh, Inc.. ALL RIGHTS RESERVED.
3 //
4 
5 
6 #ifndef xmog_jvm_loader_inc
7 #define xmog_jvm_loader_inc
8 
9 
10 #include "xmog.h"
11 #include "xmog_jvm.h"
12 #include "xmog_jvm_options.h"
13 #include "xmog_options.h"
14 #include "xmog_remote_client_options.h"
15 #include "xmog_remote_server_options.h"
16 
17 
19 
20 class xmog_jvm_loader_impl;
21 
23 
24 
228 
325 class XMOG_DECLSPEC xmog_jvm_loader : public xmog_jvm_options,
326  public xmog_options
327  XMOG_REMOTE_CLIENT_OPTIONS_INH
328  XMOG_REMOTE_SERVER_OPTIONS_INH
329 {
330 public:
369  typedef void (XMOG_CALLING_CONVENTION *XMOG_CONFIG_HOOK)( void * pLoader, int when );
370 
403  static void setConfigFile( const char * filename,
404  XMOGVERSION vers = NULL,
405  XMOGCONFIG conf = NULL,
406  XMOGVERSION reserved0 = NULL );
407 
426  static xmog_jvm_loader & get_jvm_loader( bool bEnvOverrides = true,
427  bool bDefaultJvm = true,
428  xmog_trace_facility fac = TraceAll,
429  xmog_trace_level trace_level = TraceErrors );
430 
460  static xmog_jvm_loader & get_jvm_loader( const char * filename,
461  XMOGVERSION vers,
462  XMOGCONFIG conf,
463  XMOGVERSION reserved0 = NULL,
464  bool bEnvOverrides = true,
465  bool bDefaultJvm = true,
466  xmog_trace_facility fac = TraceAll,
467  xmog_trace_level trace_level = TraceErrors );
468 
490  static xmog_jvm_loader & get_jvm_loader( const char * filename,
491  bool bEnvOverrides = true,
492  bool bDefaultJvm = true,
493  xmog_trace_facility fac = TraceAll,
494  xmog_trace_level trace_level = TraceErrors );
495 
496 
513  static xmog_jvm_loader & get_jvm_loader( int argc,
514  char * argv[],
515  bool bEnvOverrides = true,
516  bool bDefaultJvm = true,
517  xmog_trace_facility fac = TraceAll,
518  xmog_trace_level trace_level = TraceErrors );
519 
540  static xmog_jvm_loader & get_jvm_loader( XMOGVERSION vers,
541  XMOGCONFIG conf,
542  XMOGVERSION reserved0 = NULL,
543  bool bEnvOverrides = true,
544  bool bDefaultJvm = true,
545  xmog_trace_facility fac = TraceAll,
546  xmog_trace_level trace_level = TraceErrors );
547 
556  static xmog_jvm_loader * get_jvm_loader_no_create();
557 
571  virtual xmog_jvm * load( bool bAcceptPreloadedJvm = true );
572 
577  static bool isNativeInitThread();
578 
589  virtual xmog_jvm * get_jvm();
590 
597  virtual void set_jvm( xmog_jvm * jvm );
598 
605  jint getLoadResult( char ** pMsg = NULL );
606 
610  jint getLoadedJvms( xmog_jvm ** pJvms, jsize size, jsize * count );
611 
618  static const char * getDefaultJvmPath();
619 
628  static bool isInShutdownMode();
629 
638  static void enterShutdownMode();
639 
645  virtual void setJvmPath( const char * jvmPath );
646 
668  virtual void read( const char * file, XMOGVERSION vers = NULL, XMOGCONFIG conf = NULL, XMOGVERSION reserved0 = NULL );
669 
687  static void addVersionConfig( const char * vers, const char * config );
688 
697  static void registerConfigurationHook( XMOG_CONFIG_HOOK configHook );
698 
702  static void atexit_call();
703 
707  bool getEnvironmentOverrides() const;
708 
713  jint getProbableMaximumHeapSizeInMB() const;
714 
715 
716 protected:
717 
727  xmog_jvm_loader( bool bEnvOverrides, bool bDefaultJvm, xmog_trace_facility fac, xmog_trace_level );
728 
739  xmog_jvm_loader( const char * filename, bool bEnvOverrides, bool bDefaultJvm, xmog_trace_facility fac, xmog_trace_level );
740 
741 
757  xmog_jvm_loader( const char * filename, XMOGVERSION vers, XMOGCONFIG conf, XMOGVERSION reserved0, bool bEnvOverrides, bool bDefaultJvm, xmog_trace_facility fac, xmog_trace_level );
758 
759 
771  xmog_jvm_loader( int argc, char * argv[], bool bEnvOverrides, bool bDefaultJvm, xmog_trace_facility fac, xmog_trace_level );
772 
787  xmog_jvm_loader( XMOGVERSION vers, XMOGCONFIG conf, XMOGVERSION reserved0, bool bEnvOverrides, bool bDefaultJvm, xmog_trace_facility fac, xmog_trace_level );
788 
789  virtual ~xmog_jvm_loader();
790 
794  xmog_jvm * usePreloadedJvm();
795 
802  xmog_jvm * loadInProcess( bool bAcceptPreloadedJvm );
803 
811  xmog_jvm * loadOutOfProcessClient( bool bAcceptPreloadedJvm );
812 
818  xmog_jvm * loadOutOfProcessServer( bool bAcceptPreloadedJvm );
819 
828  xmog_jvm * loadOutOfProcess( bool bAcceptPreloadedJvm, bool bServer = false );
829 
847  void consolidateVersionConfigs();
848 
857  void addExtensionDirectories();
858 
859 private:
860 
861  volatile xmog_jvm * theJvm;
862 
863  volatile static bool shutdownmode;
864 
865  static char * fileName_;
866 
867  static XMOGVERSION vers_;
868 
869  static XMOGCONFIG conf_;
870 
871  static XMOGVERSION reserved0_;
872 
873  xmog_jvm_loader_impl * impl;
874 
875  jint loadResult;
876 
877  bool bEnvOverrides_;
878 
879  //
880  // Suppress copy constructor because we only ever have one instance of
881  // the loader and don't want to allow the user to inadvertently create
882  // another one by accident.
883  //
884  xmog_jvm_loader( const xmog_jvm_loader & );
885 
886  //
887  // See above.
888  //
889  xmog_jvm_loader & operator = ( const xmog_jvm_loader & );
890 };
891 
892 
893 #endif /* xmog_jvm_loader_inc */
xmog_jvm_loader
The class that acts as a factory for xmog_jvm_loaders and thereby for our JVM abstraction.
Definition: xmog_jvm_loader.h:325
xmog_trace_level
xmog_trace_level
Tracing levels for the runtime.
Definition: xmog_tracer.h:72
xmog_trace_facility
xmog_trace_facility
Tracing facilities for the runtime.
Definition: xmog_tracer.h:53
xmog_jvm_options
A class abstracting the maintenance and initialization of JVM configuration options.
Definition: xmog_jvm_options.h:174
xmog_options
This class wraps around options that govern the overall behavior of the runtime library with respect ...
Definition: xmog_options.h:258
xmog_jvm
The class that represents a Java Virtual Machine in the framework.
Definition: xmog_jvm.h:41
xmog_options::setJvmPath
virtual void setJvmPath(const char *jvmPath)
Sets the JVM path that is to be used.

Copyright (c) 1999-2020 by Codemesh, Inc., ALL RIGHTS RESERVED.