jvm

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IJava

type IJava interface {
	CreateJVM() (IJava, error) // Will create and start the JVM for any JNI threads to communicate with
	ShutdownJvm() error        // Will cleanup any threads remaining and close the JVM
	Attach() *jnigi.Env        // Will attach the current running thread to the JVM
	Detach()                   // Will detach the current thread from the JNI environment
	IsStarted() bool           // A simple flag indicating whether or not the JVM has started running
}

IJava is the interface that wraps around the JVM. It allows for creation and cleanup. Only one JVM needs to be started. It can then be shared out between goroutines to do with as needed

type Java

type Java struct {
	Env *jnigi.Env
	// contains filtered or unexported fields
}

Java is the structure that will contain JVM pertinent information.

func (*Java) Attach

func (java *Java) Attach() *jnigi.Env

Attach is the method to attach the current thread to the JNI environment. This is required in order to execute any JNI commands in the actively running threads and should be used whenever a new go routine is used

func (*Java) CreateJVM

func (java *Java) CreateJVM() (IJava, error)

CreateJVM will create a JVM for the consumer to execute against

func (*Java) Detach

func (java *Java) Detach()

Detach is the method that will unlock the active thread and remove it from the JNI environment This should be done after the attached thread completes

func (*Java) IsStarted

func (java *Java) IsStarted() bool

IsStarted will indicate whether or not the JVM has already been started

func (*Java) ShutdownJvm

func (java *Java) ShutdownJvm() error

ShutdownJvm will shut down the JVM, this should be done at the end

type MockIJava

type MockIJava struct {
	mock.Mock
}

MockIJava is an autogenerated mock type for the IJava type

func NewMockIJava

func NewMockIJava(t mockConstructorTestingTNewMockIJava) *MockIJava

NewMockIJava creates a new instance of MockIJava. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockIJava) Attach

func (_m *MockIJava) Attach() *jnigi.Env

Attach provides a mock function with given fields:

func (*MockIJava) CreateJVM

func (_m *MockIJava) CreateJVM() (IJava, error)

CreateJVM provides a mock function with given fields:

func (*MockIJava) Detach

func (_m *MockIJava) Detach()

Detach provides a mock function with given fields:

func (*MockIJava) IsStarted

func (_m *MockIJava) IsStarted() bool

IsStarted provides a mock function with given fields:

func (*MockIJava) ShutdownJvm

func (_m *MockIJava) ShutdownJvm() error

ShutdownJvm provides a mock function with given fields:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL