Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions storage/ndb/clusterj/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Clusterj
*.xml
*.iml
target
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright (c) 2010, 2024, Oracle and/or its affiliates.
Copyright (c) 2020, 2023, Hopsworks, and/or its affiliates.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down Expand Up @@ -179,6 +180,24 @@ public interface Constants {
/** The default value of the database property */
static final String DEFAULT_PROPERTY_CLUSTER_DATABASE = "test";

/** The maximum number of object instances cached per Session object, 0 = no caching */
static final String PROPERTY_CLUSTER_MAX_CACHED_INSTANCES = "com.mysql.clusterj.max.cached.instances";

/** The default value of the maximum number of cached object instances. */
static final int DEFAULT_PROPERTY_CLUSTER_MAX_CACHED_INSTANCES = 128;

/** The number of Session instances put into cache per Session Factory object, 0 = no warmup */
static final String PROPERTY_CLUSTER_WARMUP_CACHED_SESSIONS = "com.mysql.clusterj.warmup.cached.sessions";

/** The default value of the maximum number of cached object instances. */
static final int DEFAULT_PROPERTY_CLUSTER_WARMUP_CACHED_SESSIONS = 0;

/** The maximum number of Session instances cached per Session Factory object, 0 = no caching */
static final String PROPERTY_CLUSTER_MAX_CACHED_SESSIONS = "com.mysql.clusterj.max.cached.sessions";

/** The default value of the maximum number of cached object instances. */
static final int DEFAULT_PROPERTY_CLUSTER_MAX_CACHED_SESSIONS = 0;

/** The name of the maximum number of transactions property. For details, see
* <a href="http://dev.mysql.com/doc/ndbapi/en/ndb-ndb.html#ndb-ndb-init">Ndb::init()</a>
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright (c) 2010, 2024, Oracle and/or its affiliates.
Copyright (c) 2020, 2024, Hopsworks and/or its affiliates.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down Expand Up @@ -45,26 +46,23 @@ public final Object get(int columnNumber) {
return delegate.get(columnNumber);
}

public final Object get_partial(int columnNumber, int startPos, int size) {
return delegate.get_partial(columnNumber, startPos, size);
}

public final void set(int columnNumber, Object value) {
delegate.set(columnNumber, value);
}

public final void append(int columnNumber, Object value) {
delegate.append(columnNumber, value);
}

public final ColumnMetadata[] columnMetadata() {
return delegate.columnMetadata();
}

public Boolean found() {
return delegate.found();
}

@SuppressWarnings("deprecation")
protected void finalize() throws Throwable {
try {
if (delegate != null) {
delegate.release();
}
} finally {
super.finalize();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright (c) 2010, 2024, Oracle and/or its affiliates.
Copyright (c) 2024, 2024, Hopsworks and/or its affiliates.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down Expand Up @@ -29,8 +30,12 @@ public interface DynamicObjectDelegate {

public Object get(int columnNumber);

public Object get_partial(int columnNumber, int startPos, int size);

public void set(int columnNumber, Object value);

public void append(int columnNumber, Object value);

public ColumnMetadata[] columnMetadata();

public Boolean found();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright (c) 2010, 2024, Oracle and/or its affiliates.
Copyright (c) 2020, 2023, Hopsworks and/or its affiliates.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down Expand Up @@ -191,9 +192,23 @@ public interface Session extends AutoCloseable {
Transaction currentTransaction();

/** Close this session.
*
* The closeCache call can cache the session for later reuse in the SessionFactory.
* close will never do this.
*
* closeCache is an add-on by Logical Clocks
*
* If dropCache is set to true, the cached instances will
* be droppped as part of the close call, otherwise they
* are kept in the cache and can be reused when the
* object is re-opened.
* dropCache should normally be set to false for optimal performance.
* But if one expects the cost of the extra memory to be a burden one
* has the option of releasing the memory attached to those data objects.
* closeCache() is equal to closeCache(false).
*/
void close();
void closeCache(boolean dropCache);
void closeCache();

/** Is this session closed?
*
Expand Down Expand Up @@ -253,11 +268,19 @@ public interface Session extends AutoCloseable {
/** Release resources associated with an instance. The instance must be a domain object obtained via
* session.newInstance(T.class), find(T.class), or query; or Iterable<T>, or array T[].
* Resources released can include direct buffers used to hold instance data.
* Released resources may be returned to a pool.
* Released resources may be returned to a pool if releaseCache is used.
* releaseCache is an add-on by Logical Clocks
* @param obj a domain object of type T, an Iterable<T>, or array T[]
* @return the input parameter
* @throws ClusterJUserException if the instance is not a domain object T, Iterable<T>, or array T[],
* or if the object is used after calling this method.
*/
<T> T release(T obj);
<T> T releaseCache(T obj, Class<?> cls);

/** Release all cached instances of a certain type or all types.
* Added by Logical Clocks.
*/
<T> void dropInstanceCache(Class<?> type);
void dropInstanceCache();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2010, 2024, Oracle and/or its affiliates.
* Copyright (c) 2020, 2023, Hopsworks, and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2.0,
Expand Down Expand Up @@ -34,11 +35,17 @@
public interface SessionFactory {

/** Create a Session to use with the cluster, using all the
* properties of the SessionFactory.
* properties of the SessionFactory. The default database is used.
* @return the session
*/
Session getSession();

/** Create a Session to use with the cluster, using all the
* properties of the SessionFactory with a new database name.
* @return the session
*/
Session getSession(String db);

/** Create a session to use with the cluster, overriding some properties.
* Properties PROPERTY_CLUSTER_CONNECTSTRING, PROPERTY_CLUSTER_DATABASE,
* and PROPERTY_CLUSTER_MAX_TRANSACTIONS may not be overridden.
Expand Down Expand Up @@ -153,4 +160,9 @@ public enum State {
*/
public int getRecvThreadActivationThreshold();

/**
* Drop the session cache.
* Added by Logical Clocks.
*/
public void dropSessionCache();
}
4 changes: 4 additions & 0 deletions storage/ndb/clusterj/clusterj-core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright (c) 2010, 2024, Oracle and/or its affiliates.
# Copyright (c) 2020, 2023, Hopsworks and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
Expand Down Expand Up @@ -30,16 +31,19 @@ SET ( BROKEN_JAVAC
${CMAKE_CURRENT_SOURCE_DIR}/src/main/java/com/mysql/clusterj/core/query/*.java
${CMAKE_CURRENT_SOURCE_DIR}/src/main/java/com/mysql/clusterj/core/spi/*.java
${CMAKE_CURRENT_SOURCE_DIR}/src/main/java/com/mysql/clusterj/core/store/*.java
${CMAKE_CURRENT_SOURCE_DIR}/src/main/java/com/mysql/clusterj/core/dtocache/*.java
${CMAKE_CURRENT_SOURCE_DIR}/src/main/java/com/mysql/clusterj/core/util/*.java)

SET(JAVA_SOURCES
${CLUSTERJ_CORE_PREFIX}/CacheManager.java
${CLUSTERJ_CORE_PREFIX}/SessionFactoryImpl.java
${CLUSTERJ_CORE_PREFIX}/SessionFactoryServiceImpl.java
${CLUSTERJ_CORE_PREFIX}/SessionCache.java
${CLUSTERJ_CORE_PREFIX}/SessionImpl.java
${CLUSTERJ_CORE_PREFIX}/StateManager.java
${CLUSTERJ_CORE_PREFIX}/StoreManager.java
${CLUSTERJ_CORE_PREFIX}/TransactionImpl.java
${CLUSTERJ_CORE_PREFIX}/dtocache/DTOCache.java
${CLUSTERJ_CORE_PREFIX}/metadata/AbstractDomainFieldHandlerImpl.java
${CLUSTERJ_CORE_PREFIX}/metadata/AbstractDomainTypeHandlerImpl.java
${CLUSTERJ_CORE_PREFIX}/metadata/DomainFieldHandlerImpl.java
Expand Down
Loading