proj_name
stringclasses
131 values
relative_path
stringlengths
30
228
class_name
stringlengths
1
68
func_name
stringlengths
1
48
masked_class
stringlengths
78
9.82k
func_body
stringlengths
46
9.61k
len_input
int64
29
2.01k
len_output
int64
14
1.94k
total
int64
55
2.05k
relevant_context
stringlengths
0
38.4k
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/common/filter/AuthFilter.java
AuthFilter
doFilter
class AuthFilter implements Filter { private static final Logger log = LoggerFactory.getLogger(AuthFilter.class); public void init(FilterConfig config) throws ServletException { } public void destroy() { } /** * doFilter determines if user is an administrator or redirect to login page ...
HttpServletRequest servletRequest = (HttpServletRequest) req; HttpServletResponse servletResponse = (HttpServletResponse) resp; boolean isAdmin = false; try { //read auth token String authToken = AuthUtil.getAuthToken(servletRequest.getSession()); ...
159
566
725
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/common/util/AppConfig.java
AppConfig
decryptProperty
class AppConfig { private static final Logger log = LoggerFactory.getLogger(AppConfig.class); private static PropertiesConfiguration prop; public static final String CONFIG_DIR = StringUtils.isNotEmpty(System.getProperty("CONFIG_DIR")) ? System.getProperty("CONFIG_DIR").trim() : AppConfig.class.getClassLoa...
String retVal = prop.getString(name); if (StringUtils.isNotEmpty(retVal)) { retVal = retVal.replaceAll("^" + EncryptionUtil.CRYPT_ALGORITHM + "\\{", "").replaceAll("\\}$", ""); retVal = EncryptionUtil.decrypt(retVal); } return retVal;
1,308
97
1,405
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/common/util/AuthUtil.java
AuthUtil
getAuthToken
class AuthUtil { public static final String SESSION_ID = "sessionId"; public static final String USER_ID = "userId"; public static final String USERNAME = "username"; public static final String AUTH_TOKEN = "authToken"; public static final String TIMEOUT = "timeout"; private AuthUtil() { }...
String authToken = (String) session.getAttribute(AUTH_TOKEN); authToken = EncryptionUtil.decrypt(authToken); return authToken;
1,815
45
1,860
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/control/LoginKtrl.java
LoginKtrl
loginSubmit
class LoginKtrl extends BaseKontroller { private static final Logger log = LoggerFactory.getLogger(LoginKtrl.class); //check if otp is enabled @Model(name = "otpEnabled") static final Boolean otpEnabled = ("required".equals(AppConfig.getProperty("oneTimePassword")) || "optional".equals(AppConfig...
String retVal = "redirect:/admin/menu.html"; String authToken = null; try { authToken = AuthDB.login(auth); //get client IP String clientIP = AuthUtil.getClientIPAddress(getRequest()); if (authToken != null) { User us...
572
868
1,440
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/control/OTPKtrl.java
OTPKtrl
qrImage
class OTPKtrl extends BaseKontroller { private static final Logger log = LoggerFactory.getLogger(OTPKtrl.class); public static final boolean requireOTP = "required".equals(AppConfig.getProperty("oneTimePassword")); //QR image size private static final int QR_IMAGE_WIDTH = 325; private sta...
String username; String secret; try { username = UserDB.getUser(AuthUtil.getUserId(getRequest().getSession())).getUsername(); secret = AuthUtil.getOTPSecret(getRequest().getSession()); AuthUtil.setOTPSecret(getRequest().getSession(), null); }...
592
675
1,267
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/control/ProfileKtrl.java
ProfileKtrl
saveProfile
class ProfileKtrl extends BaseKontroller { private static final Logger log = LoggerFactory.getLogger(ProfileKtrl.class); @Model(name = "sortedSet") SortedSet sortedSet = new SortedSet(); @Model(name = "profile") Profile profile = new Profile(); public ProfileKtrl(HttpServletRequest r...
try { if (profile.getId() != null) { ProfileDB.updateProfile(profile); } else { ProfileDB.insertProfile(profile); } } catch (SQLException | GeneralSecurityException ex) { log.error(ex.toString(), ex); ...
693
161
854
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/control/ProfileSystemsKtrl.java
ProfileSystemsKtrl
viewProfileSystems
class ProfileSystemsKtrl extends BaseKontroller { private static final Logger log = LoggerFactory.getLogger(ProfileSystemsKtrl.class); @Model(name = "profile") Profile profile; @Model(name = "sortedSet") SortedSet sortedSet = new SortedSet(); @Model(name = "systemSelectId") List<Long> syst...
if (profile != null && profile.getId() != null) { try { profile = ProfileDB.getProfile(profile.getId()); sortedSet = SystemDB.getSystemSet(sortedSet, profile.getId()); } catch (SQLException | GeneralSecurityException ex) { log.error(ex.toS...
361
122
483
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/control/ProfileUsersKtrl.java
ProfileUsersKtrl
assignSystemsToProfile
class ProfileUsersKtrl extends BaseKontroller { private static final Logger log = LoggerFactory.getLogger(ProfileUsersKtrl.class); @Model(name = "profile") Profile profile; @Model(name = "sortedSet") SortedSet sortedSet = new SortedSet(); @Model(name = "userSelectId") List<Long> userSelect...
if (userSelectId != null) { try { UserProfileDB.setUsersForProfile(profile.getId(), userSelectId); } catch (SQLException | GeneralSecurityException ex) { log.error(ex.toString(), ex); throw new ServletException(ex.toString(), ex); ...
351
120
471
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/control/ScriptKtrl.java
ScriptKtrl
validateSaveScript
class ScriptKtrl extends BaseKontroller { private static final Logger log = LoggerFactory.getLogger(ScriptKtrl.class); @Model(name = "sortedSet") SortedSet sortedSet = new SortedSet(); @Model(name = "script") Script script = new Script(); public ScriptKtrl(HttpServletRequest request, HttpServ...
if (script == null || script.getDisplayNm() == null || script.getDisplayNm().trim().equals("")) { addFieldError("script.displayNm", "Required"); } if (script == null || script.getScript() == null || script.getScript()....
707
227
934
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/control/SessionAuditKtrl.java
SessionAuditKtrl
getJSONTermOutputForSession
class SessionAuditKtrl extends BaseKontroller { private static final Logger log = LoggerFactory.getLogger(SessionAuditKtrl.class); @Model(name = "sortedSet") SortedSet sortedSet = new SortedSet(); @Model(name = "sessionId") Long sessionId; @Model(name = "instanceId") Integer instanceId; ...
try { String json = new Gson().toJson(SessionAuditDB.getTerminalLogsForSession(sessionId, instanceId)); getResponse().getOutputStream().write(json.getBytes()); } catch (SQLException | GeneralSecurityException | IOException ex) { log.error(ex.toString(), ex); ...
644
106
750
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/control/SystemKtrl.java
SystemKtrl
validateSaveSystem
class SystemKtrl extends BaseKontroller { private static final Logger log = LoggerFactory.getLogger(SystemKtrl.class); public static final String REQUIRED = "Required"; @Model(name = "sortedSet") SortedSet sortedSet = new SortedSet(); @Model(name = "hostSystem") HostSystem hostSystem =...
if (hostSystem == null || hostSystem.getDisplayNm() == null || hostSystem.getDisplayNm().trim().equals("")) { addFieldError("hostSystem.displayNm", REQUIRED); } if (hostSystem == null || hostSystem.getUser() == null ...
1,208
432
1,640
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/control/UploadAndPushKtrl.java
UploadAndPushKtrl
push
class UploadAndPushKtrl extends BaseKontroller { private static final Logger log = LoggerFactory.getLogger(UploadAndPushKtrl.class); public static final String UPLOAD_PATH = DBUtils.class.getClassLoader().getResource(".").getPath() + "../upload"; @Model(name = "upload") File upload; @Model(name = ...
try { Long userId = AuthUtil.getUserId(getRequest().getSession()); Long sessionId = AuthUtil.getSessionId(getRequest().getSession()); //get next pending system pendingSystemStatus = SystemStatusDB.getNextPendingSystem(userId); if (pendingSystemStat...
750
689
1,439
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/control/UserSettingsKtrl.java
UserSettingsKtrl
passwordSubmit
class UserSettingsKtrl extends BaseKontroller { private static final Logger log = LoggerFactory.getLogger(UserSettingsKtrl.class); public static final String REQUIRED = "Required"; @Model(name = "themeMap") static Map<String, String> themeMap1 = new LinkedHashMap<>(Map.ofEntries( en...
String retVal = "/admin/user_settings.html"; if (!auth.getPassword().equals(auth.getPasswordConfirm())) { addError("Passwords do not match"); } else if (!PasswordUtil.isValid(auth.getPassword())) { addError(PasswordUtil.PASSWORD_REQ_ERROR_MSG); } else...
1,212
245
1,457
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/control/UsersKtrl.java
UsersKtrl
validateSaveUser
class UsersKtrl extends BaseKontroller { private static final Logger log = LoggerFactory.getLogger(UsersKtrl.class); public static final String REQUIRED = "Required"; @Model(name = "sortedSet") SortedSet sortedSet = new SortedSet(); @Model(name = "user") User user = new User(); @M...
if (user == null || user.getUsername() == null || user.getUsername().trim().equals("")) { addFieldError("user.username", REQUIRED); } if (user == null || user.getLastNm() == null || user.getLastNm().trim().equ...
1,133
528
1,661
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/db/PrivateKeyDB.java
PrivateKeyDB
getApplicationKey
class PrivateKeyDB { private PrivateKeyDB() { } /** * returns public private key for application * * @return app key values */ public static ApplicationKey getApplicationKey() throws SQLException, GeneralSecurityException {<FILL_FUNCTION_BODY>} }
ApplicationKey appKey = null; Connection con = DBUtils.getConn(); PreparedStatement stmt = con.prepareStatement("select * from application_key"); ResultSet rs = stmt.executeQuery(); while (rs.next()) { appKey = new ApplicationKey(); appKey.setId(rs...
77
207
284
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/db/ProfileDB.java
ProfileDB
getProfileSet
class ProfileDB { public static final String FILTER_BY_SYSTEM = "system"; public static final String FILTER_BY_USER = "username"; public static final String SORT_BY_PROFILE_NM = "nm"; private ProfileDB() { } /** * method to do order by based on the sorted set object for profiles * ...
ArrayList<Profile> profileList = new ArrayList<>(); String orderBy = ""; if (sortedSet.getOrderByField() != null && !sortedSet.getOrderByField().trim().equals("")) { orderBy = " order by " + sortedSet.getOrderByField() + " " + sortedSet.getOrderByDirection(); } Str...
1,136
785
1,921
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/db/ProfileSystemsDB.java
ProfileSystemsDB
getSystemIdsByProfile
class ProfileSystemsDB { private ProfileSystemsDB() { } /** * sets host systems for profile * * @param profileId profile id * @param systemIdList list of host system ids */ public static void setSystemsForProfile(Long profileId, List<Long> systemIdList) throws SQLException,...
List<Long> systemIdList = new ArrayList<>(); PreparedStatement stmt = con.prepareStatement("select * from system s, system_map m where s.id=m.system_id and m.profile_id=? order by display_nm asc"); stmt.setLong(1, profileId); ResultSet rs = stmt.executeQuery(); while (rs.next...
1,344
151
1,495
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/db/ScriptDB.java
ScriptDB
getScript
class ScriptDB { public static final String DISPLAY_NM = "display_nm"; public static final String SORT_BY_DISPLAY_NM = DISPLAY_NM; private ScriptDB() { } /** * returns scripts based on sort order defined * * @param sortedSet object that defines sort order * @param userId u...
Script script = null; PreparedStatement stmt = con.prepareStatement("select * from scripts where id=? and user_id=?"); stmt.setLong(1, scriptId); stmt.setLong(2, userId); ResultSet rs = stmt.executeQuery(); while (rs.next()) { script = new Script(); ...
1,177
175
1,352
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/db/SystemStatusDB.java
SystemStatusDB
getNextPendingSystem
class SystemStatusDB { public static final String STATUS_CD = "status_cd"; private SystemStatusDB() { } /** * set the initial status for selected systems * * @param systemSelectIds systems ids to set initial status * @param userId user id * @param userType use...
HostSystem hostSystem = null; Connection con = DBUtils.getConn(); PreparedStatement stmt = con.prepareStatement("select * from status where (status_cd like ? or status_cd like ? or status_cd like ?) and user_id=? order by id asc"); stmt.setString(1, HostSystem.INITIAL_STATUS); ...
1,683
255
1,938
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/db/UserProfileDB.java
UserProfileDB
checkIsUsersProfile
class UserProfileDB { private UserProfileDB() { } /** * sets users for profile * * @param profileId profile id * @param userIdList list of user ids */ public static void setUsersForProfile(Long profileId, List<Long> userIdList) throws SQLException, GeneralSecurityException { ...
boolean isUsersProfile = false; Connection con = DBUtils.getConn(); PreparedStatement stmt = con.prepareStatement("select * from user_map where profile_id=? and user_id=?"); stmt.setLong(1, profileId); stmt.setLong(2, userId); ResultSet rs = stmt.executeQuery(); ...
1,593
159
1,752
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/db/UserThemeDB.java
UserThemeDB
getTheme
class UserThemeDB { private UserThemeDB() { } /** * get user theme * * @param userId object * @return user theme object */ public static UserSettings getTheme(Long userId) throws SQLException, GeneralSecurityException {<FILL_FUNCTION_BODY>} /** * saves user theme ...
UserSettings theme = null; Connection con = DBUtils.getConn(); PreparedStatement stmt = con.prepareStatement("select * from user_theme where user_id=?"); stmt.setLong(1, userId); ResultSet rs = stmt.executeQuery(); if (rs.next()) { theme = new UserSettings(...
541
456
997
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/model/SortedSet.java
SortedSet
getOrderByField
class SortedSet { private String orderByField = null; private String orderByDirection = "asc"; private List itemList; private Map<String, String> filterMap = new HashMap<>(); public SortedSet() { } public SortedSet(String orderByField) { this.orderByField = orderByField; } ...
if (orderByField != null) { return orderByField.replaceAll("[^0-9,a-z,A-Z,\\_,\\.]", ""); } return null;
334
55
389
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/model/UserSettings.java
UserSettings
setPlane
class UserSettings { String[] colors = null; String bg; String fg; String plane; String theme; Integer ptyWidth; Integer ptyHeight; public String[] getColors() { return colors; } public void setColors(String[] colors) { this.colors = colors; } public S...
if (StringUtils.isNotEmpty(plane) && plane.split(",").length == 2) { this.setBg(plane.split(",")[0]); this.setFg(plane.split(",")[1]); } this.plane = plane;
494
73
567
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/task/SecureShellTask.java
SecureShellTask
run
class SecureShellTask implements Runnable { private static final Logger log = LoggerFactory.getLogger(SecureShellTask.class); InputStream outFromChannel; SessionOutput sessionOutput; public SecureShellTask(SessionOutput sessionOutput, InputStream outFromChannel) { this.sessionOutput = sessio...
InputStreamReader isr = new InputStreamReader(outFromChannel); BufferedReader br = new BufferedReader(isr); SessionOutputUtil.addOutput(sessionOutput); char[] buff = new char[1024]; int read; try { while ((read = br.read(buff)) != -1) { Sess...
121
183
304
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/task/SentOutputTask.java
SentOutputTask
run
class SentOutputTask implements Runnable { private static final Logger log = LoggerFactory.getLogger(SentOutputTask.class); Session session; Long sessionId; User user; public SentOutputTask(Long sessionId, Session session, User user) { this.sessionId = sessionId; this.session = se...
Gson gson = new Gson(); while (session.isOpen()) { try { Connection con = DBUtils.getConn(); List<SessionOutput> outputList = SessionOutputUtil.getOutput(con, sessionId, user); if (!outputList.isEmpty()) { String json = gso...
120
171
291
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/util/DSPool.java
DSPool
registerDataSource
class DSPool { private static BasicDataSource dsPool = null; private static final String BASE_DIR = AppConfig.CONFIG_DIR; private static final String DB_DRIVER = AppConfig.getProperty("dbDriver"); private static final int MAX_ACTIVE = Integer.parseInt(AppConfig.getProperty("maxActive")); private s...
System.setProperty("h2.baseDir", BASE_DIR); // create a database connection String user = AppConfig.getProperty("dbUser"); String password = AppConfig.decryptProperty("dbPassword"); String connectionURL = AppConfig.getProperty("dbConnectionURL"); if (connectionURL != n...
320
269
589
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/util/EncryptionUtil.java
EncryptionUtil
encrypt
class EncryptionUtil { private static final Logger log = LoggerFactory.getLogger(EncryptionUtil.class); //secret key private static byte[] key = new byte[0]; static { try { key = KeyStoreUtil.getSecretBytes(KeyStoreUtil.ENCRYPTION_KEY_ALIAS); } catch (GeneralSecurityExcept...
String retVal = null; if (str != null && str.length() > 0) { Cipher c = Cipher.getInstance(CRYPT_ALGORITHM); c.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, CRYPT_ALGORITHM)); byte[] encVal = c.doFinal(str.getBytes()); retVal = new String(Base64.encod...
912
131
1,043
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/util/KeyStoreUtil.java
KeyStoreUtil
initializeKeyStore
class KeyStoreUtil { private static final Logger log = LoggerFactory.getLogger(KeyStoreUtil.class); private static KeyStore keyStore = null; private static final String keyStoreFile = AppConfig.CONFIG_DIR + "/bastillion.jceks"; private static final char[] KEYSTORE_PASS = new char[]{ ...
keyStore = KeyStore.getInstance("JCEKS"); //create keystore keyStore.load(null, KEYSTORE_PASS); //set encryption key KeyGenerator keyGenerator = KeyGenerator.getInstance("AES"); keyGenerator.init(KEYLENGTH); KeyStoreUtil.setSecret(KeyStoreUtil.ENCRYPTION_KEY_ALI...
1,649
152
1,801
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/util/OTPUtil.java
OTPUtil
verifyToken
class OTPUtil { private static final Logger log = LoggerFactory.getLogger(OTPUtil.class); //sizes to generate OTP secret private static final int SECRET_SIZE = 10; private static final int NUM_SCRATCH_CODES = 5; private static final int SCRATCH_CODE_SIZE = 4; //token window in near future or ...
long calculated = -1; byte[] key = new Base32().decode(secret); SecretKeySpec secretKey = new SecretKeySpec(key, "HmacSHA1"); try { Mac mac = Mac.getInstance("HmacSHA1"); mac.init(secretKey); byte[] hash = mac.doFinal(ByteBuffer.allocate(8).putLon...
540
240
780
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/util/RefreshAuthKeyUtil.java
RefreshAllSystemsTask
run
class RefreshAllSystemsTask implements Runnable { private static final Logger log = LoggerFactory.getLogger(RefreshAllSystemsTask.class); @Override public void run() {<FILL_FUNCTION_BODY>} }
//distribute all public keys try { SSHUtil.distributePubKeysToAllSystems(); } catch (SQLException | GeneralSecurityException ex) { log.error(ex.toString(), ex); }
65
59
124
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/util/SessionOutputSerializer.java
SessionOutputSerializer
serialize
class SessionOutputSerializer implements JsonSerializer<Object> { @Override public JsonElement serialize(Object src, Type typeOfSrc, JsonSerializationContext context) {<FILL_FUNCTION_BODY>} }
JsonObject object = new JsonObject(); if (typeOfSrc.equals(AuditWrapper.class)) { AuditWrapper auditWrapper = (AuditWrapper) src; object.addProperty("user_id", auditWrapper.getUser().getId()); object.addProperty("username", auditWrapper.getUser().getUsername()); ...
54
296
350
<no_super_class>
bastillion-io_Bastillion
Bastillion/src/main/java/io/bastillion/manage/util/SessionOutputUtil.java
SessionOutputUtil
getOutput
class SessionOutputUtil { private static final Map<Long, UserSessionsOutput> userSessionsOutputMap = new ConcurrentHashMap<>(); public final static boolean enableInternalAudit = "true".equals(AppConfig.getProperty("enableInternalAudit")); private static final Gson gson = new GsonBuilder().registerTypeAdapt...
List<SessionOutput> outputList = new ArrayList<>(); UserSessionsOutput userSessionsOutput = userSessionsOutputMap.get(sessionId); if (userSessionsOutput != null) { for (Integer key : userSessionsOutput.getSessionOutputMap().keySet()) { //get output chars and set t...
787
267
1,054
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/ChronicleHashCloseOnExitHook.java
ChronicleHashCloseOnExitHook
closeAll
class ChronicleHashCloseOnExitHook { private static WeakHashMap<VanillaChronicleHash<?, ?, ?, ?>.Identity, Long> maps = new WeakHashMap<>(); private static long order = 0; static { PriorityHook.add(80, ChronicleHashCloseOnExitHook::closeAll); } private ChronicleHashCloseOnExitHook() { ...
try { WeakHashMap<VanillaChronicleHash<?, ?, ?, ?>.Identity, Long> maps; synchronized (ChronicleHashCloseOnExitHook.class) { maps = ChronicleHashCloseOnExitHook.maps; ChronicleHashCloseOnExitHook.maps = null; } TreeMap<Long, Vanil...
250
541
791
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/InMemoryChronicleHashResources.java
InMemoryChronicleHashResources
releaseMemoryResource
class InMemoryChronicleHashResources extends ChronicleHashResources { @Override void releaseMemoryResource(final MemoryResource allocation) {<FILL_FUNCTION_BODY>} }
assert SKIP_ASSERTIONS || assertAddress(allocation.address); assert SKIP_ASSERTIONS || assertPosition(allocation.size); OS.memory().freeMemory(allocation.address, allocation.size);
46
57
103
<methods>public non-sealed void <init>() ,public final boolean releaseManually() ,public void run() ,public final void setChronicleHashIdentityString(java.lang.String) <variables>private static final int COMPLETELY_CLOSED,private static final int OPEN,private static final int PARTIALLY_CLOSED,private java.lang.String c...
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/IntCompactOffHeapLinearHashTable.java
IntCompactOffHeapLinearHashTable
writeEntryVolatile
class IntCompactOffHeapLinearHashTable extends CompactOffHeapLinearHashTable { private static final long SCALE = 4L; /** * Must not store {@code h} in a field, to avoid memory leaks. * * @see net.openhft.chronicle.hash.impl.stage.hash.Chaining#initMap */ IntCompactOffHeapLinearHashTabl...
assert SKIP_ASSERTIONS || assertAddress(address); assert SKIP_ASSERTIONS || assertPosition(pos); OS.memory().writeVolatileInt(address + pos, (int) entry(key, value));
557
57
614
<methods>public static long capacityFor(long) ,public void checkValueForPut(long) ,public abstract void clearEntry(long, long) ,public boolean empty(long) ,public long entry(long, long) ,public static int entrySize(int, int) ,public long hlPos(long) ,public long key(long) ,public static int keyBits(long, int) ,public s...
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/LongCompactOffHeapLinearHashTable.java
LongCompactOffHeapLinearHashTable
clearEntry
class LongCompactOffHeapLinearHashTable extends CompactOffHeapLinearHashTable { private static final long SCALE = 8L; /** * Must not store {@code h} in a field, to avoid memory leaks. * * @see net.openhft.chronicle.hash.impl.stage.hash.Chaining#initMap */ LongCompactOffHeapLinearHashTa...
assert SKIP_ASSERTIONS || assertAddress(address); assert SKIP_ASSERTIONS || assertPosition(pos); OS.memory().writeLong(address + pos, 0L);
570
50
620
<methods>public static long capacityFor(long) ,public void checkValueForPut(long) ,public abstract void clearEntry(long, long) ,public boolean empty(long) ,public long entry(long, long) ,public static int entrySize(int, int) ,public long hlPos(long) ,public long key(long) ,public static int keyBits(long, int) ,public s...
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/PersistedChronicleHashResources.java
PersistedChronicleHashResources
releaseExtraSystemResources
class PersistedChronicleHashResources extends ChronicleHashResources { private File file; public PersistedChronicleHashResources(File file) { this.file = file; OS.memory().storeFence(); // Emulate final semantics of the file field } @Override void releaseMemoryResource(MemoryResou...
if (file == null) return null; Throwable thrown = null; try { CanonicalRandomAccessFiles.release(file); file = null; } catch (Throwable t) { thrown = t; } return thrown;
136
71
207
<methods>public non-sealed void <init>() ,public final boolean releaseManually() ,public void run() ,public final void setChronicleHashIdentityString(java.lang.String) <variables>private static final int COMPLETELY_CLOSED,private static final int OPEN,private static final int PARTIALLY_CLOSED,private java.lang.String c...
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/data/bytes/EntryKeyBytesData.java
EntryKeyBytesData
innerGetUsing
class EntryKeyBytesData<K> extends AbstractData<K> { @StageRef VanillaChronicleHashHolder<K> hh; @StageRef KeyBytesInterop<K> ki; @StageRef SegmentStages s; @StageRef HashEntryStages<K> entry; @StageRef CheckOnEachPublicOperation checkOnEachPublicOperation; @Stage("CachedEn...
Bytes bytes = s.segmentBytesForRead(); bytes.readPosition(entry.keyOffset); return ki.keyReader.read(bytes, size(), usingKey);
450
47
497
<methods>public boolean equals(java.lang.Object) ,public int hashCode() ,public java.lang.String toString() <variables>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/data/bytes/InputKeyBytesData.java
InputKeyBytesData
initInputKeyBytesStore
class InputKeyBytesData<K> extends AbstractData<K> { @Stage("InputKeyBytes") private final VanillaBytes inputKeyBytes = VanillaBytes.vanillaBytes();; @StageRef KeyBytesInterop<K> ki; @StageRef CheckOnEachPublicOperation checkOnEachPublicOperation; @Stage("InputKeyBytesStore") private By...
inputKeyBytesStore = bytesStore; inputKeyBytesOffset = offset; inputKeyBytesSize = size;
642
31
673
<methods>public boolean equals(java.lang.Object) ,public int hashCode() ,public java.lang.String toString() <variables>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/entry/AllocatedChunks.java
AllocatedChunks
initEntryAndKeyCopying
class AllocatedChunks { @StageRef public VanillaChronicleHashHolder<?> hh; @StageRef public SegmentStages s; @StageRef public HashEntryStages<?> entry; @StageRef public Alloc alloc; public int allocatedChunks = 0; public void initAllocatedChunks(int allocatedChunks) { ...
initAllocatedChunks(hh.h().inChunks(entrySize)); long oldSegmentTierBaseAddr = s.tierBaseAddr; long oldKeySizeAddr = oldSegmentTierBaseAddr + entry.keySizeOffset; long oldKeyAddr = oldSegmentTierBaseAddr + entry.keyOffset; int tierBeforeAllocation = s.tier; long pos = al...
188
153
341
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/entry/HashEntryChecksumStrategy.java
HashEntryChecksumStrategy
computeChecksum
class HashEntryChecksumStrategy implements ChecksumStrategy { @StageRef SegmentStages s; @StageRef HashEntryStages<?> e; @StageRef KeyHashCode h; @Override public void computeAndStoreChecksum() { int checksum = computeChecksum(); s.segmentBS.writeInt(e.entryEnd(), check...
long keyHashCode = h.keyHashCode(); long keyEnd = e.keyEnd(); long len = e.entryEnd() - keyEnd; long checksum; if (len > 0) { long addr = s.tierBaseAddr + keyEnd; long payloadChecksum = LongHashFunction.xx_r39().hashMemory(addr, len); checks...
257
173
430
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/entry/HashEntryStages.java
HashEntryStages
checkSum
class HashEntryStages<K> implements HashEntry<K>, ChecksumEntry { @StageRef public VanillaChronicleHashHolder<?> hh; @StageRef public SegmentStages s; @StageRef public CheckOnEachPublicOperation checkOnEachPublicOperation; @StageRef public HashLookupPos hlp; public long pos = -1; ...
checkOnEachPublicOperation.checkOnEachPublicOperation(); if (!hh.h().checksumEntries) { throw new UnsupportedOperationException(hh.h().toIdentityString() + ": Checksum is not stored in this Chronicle Hash"); } // This is needed, because a concurrent updat...
1,527
158
1,685
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/entry/HashLookupPos.java
HashLookupPos
initHashLookupPos
class HashLookupPos { public long hashLookupPos = -1; @StageRef HashLookupSearch hls; @StageRef SegmentStages s; public abstract boolean hashLookupPosInit(); public void initHashLookupPos() {<FILL_FUNCTION_BODY>} public void initHashLookupPos(long hashLookupPos) { this.hashLo...
// Validation + make hashLookupPos a dependant of tier. This is needed, because after // tier change should re-perform hashLookupSearch, starting from the searchStartPos. // Not an assert statement, because segmentTier stage should be initialized regardless // assertions enabled or not....
180
121
301
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/entry/HashLookupSearch.java
HashLookupSearch
nextPos
class HashLookupSearch { @StageRef public VanillaChronicleHashHolder<?> hh; @Stage("SearchKey") public long searchStartPos; @StageRef SegmentStages s; @StageRef HashLookupPos hlp; @StageRef KeySearch<?> ks; @StageRef MapEntryStages<?, ?> e; @Stage("SearchKey") lo...
long pos = hlp.hashLookupPos; CompactOffHeapLinearHashTable hl = hl(); while (true) { // read volatile to make a happens-before edge between entry insertion from concurrent // thread under update lock and this thread (reading the entry) long entry = hl.readEn...
618
222
840
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/entry/ReadLock.java
ReadLock
unlock
class ReadLock implements InterProcessLock { @StageRef CheckOnEachPublicOperation checkOnEachPublicOperation; @StageRef SegmentStages s; @StageRef HashEntryStages entry; @StageRef HashLookupPos hlp; @Override public boolean isHeldByCurrentThread() { checkOnEachPublicOpe...
checkOnEachPublicOperation.checkOnEachLockOperation(); if (s.localLockState != UNLOCKED) { // TODO what should close here? hlp.closeHashLookupPos(); entry.closeEntry(); } s.readUnlockAndDecrementCount(); s.setLocalLockState(UNLOCKED);
825
89
914
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/entry/UpdateLock.java
UpdateLock
unlock
class UpdateLock implements InterProcessLock { @StageRef VanillaChronicleHashHolder<?> hh; @StageRef CheckOnEachPublicOperation checkOnEachPublicOperation; @StageRef SegmentStages s; @StageRef HashEntryStages<?> entry; @Override public boolean isHeldByCurrentThread() { ...
checkOnEachPublicOperation.checkOnEachLockOperation(); switch (s.localLockState) { case UNLOCKED: case READ_LOCKED: return; case UPDATE_LOCKED: entry.closeDelayedUpdateChecksum(); if (s.decrementUpdate() == 0 && s.write...
1,445
242
1,687
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/hash/Chaining.java
Chaining
initUsed
class Chaining extends ChainingInterface { public final List<ChainingInterface> contextChain; public final int indexInContextChain; /** * First context, ever created in this thread. rootContextInThisThread === contextChain.get(0). */ public final ChainingInterface rootContextInThisThread; ...
assert used; firstContextLockedInThisThread = rootContextInThisThread.lockContextLocally(map); initMap(map); this.used = true;
1,304
46
1,350
<methods>public non-sealed void <init>() ,public abstract T getContext(Class<? extends T>, BiFunction<net.openhft.chronicle.hash.impl.stage.hash.ChainingInterface,VanillaChronicleMap#RAW,T>, VanillaChronicleMap#RAW) ,public abstract List<net.openhft.chronicle.hash.impl.stage.hash.ChainingInterface> getContextChain() ,p...
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/hash/OwnerThreadHolder.java
OwnerThreadHolder
checkAccessingFromOwnerThread
class OwnerThreadHolder { final Thread owner = Thread.currentThread(); @StageRef VanillaChronicleHashHolder<?> hh; public void checkAccessingFromOwnerThread() {<FILL_FUNCTION_BODY>} }
if (owner != Thread.currentThread()) { throw new ConcurrentModificationException(hh.h().toIdentityString() + ": Context shouldn't be accessed from multiple threads"); }
67
52
119
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/hash/ThreadLocalState.java
ThreadLocalState
closeContext
class ThreadLocalState { private static final Memory MEMORY = OS.memory(); private static final long CONTEXT_LOCK_OFFSET; private static final int CONTEXT_UNLOCKED = 0; private static final int CONTEXT_LOCKED_LOCALLY = 1; private static final int CONTEXT_CLOSED = 2; static { try { ...
if (tryCloseContext()) return; // Unless there are bugs in this codebase, it could happen that // contextLock == CONTEXT_CLOSED here only if closeContext() has succeed, and the subsequent // contextHolder.clear() has failed in ChronicleHashResources.closeContext(), though th...
912
923
1,835
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/iter/HashSegmentIteration.java
HashSegmentIteration
forEachTierEntryWhile
class HashSegmentIteration<K, E extends HashEntry<K>> implements HashEntry<K>, HashSegmentContext<K, E> { @StageRef public IterationSegmentStages s; @StageRef public CheckOnEachPublicOperation checkOnEachPublicOperation; public boolean entryRemovedOnThisIteration = false; public long ha...
long leftEntries = tierEntriesForIteration(); boolean interrupted = false; long startPos = 0L; CompactOffHeapLinearHashTable hashLookup = hh.h().hashLookup; // volatile read not needed because iteration is performed at least under update lock while (!hashLookup.empty(has...
1,080
851
1,931
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/iter/IterationAlloc.java
IterationAlloc
alloc
class IterationAlloc implements Alloc { @StageRef public SegmentStages s; /** * Move only to next tiers, to avoid double visiting of relocated entries during iteration */ @Override public long alloc(int chunks, long prevPos, int prevChunks) {<FILL_FUNCTION_BODY>} }
long ret = s.allocReturnCode(chunks); if (prevPos >= 0) s.free(prevPos, prevChunks); if (ret >= 0) return ret; while (true) { s.nextTier(); ret = s.allocReturnCode(chunks); if (ret >= 0) return ret; } ...
91
96
187
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/iter/IterationKeyHashCode.java
IterationKeyHashCode
initKeyHash
class IterationKeyHashCode implements KeyHashCode { @StageRef VanillaChronicleHashHolder<?> hh; @StageRef SegmentStages s; @StageRef HashEntryStages<?> e; long keyHash = 0; void initKeyHash() {<FILL_FUNCTION_BODY>} @Override public long keyHashCode() { return keyHash;...
long addr = s.tierBaseAddr + e.keyOffset; long len = e.keySize; keyHash = LongHashFunction.xx_r39().hashMemory(addr, len);
120
52
172
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/iter/IterationSegmentStages.java
IterationSegmentStages
checkNestedContextsQueryDifferentKeys
class IterationSegmentStages extends SegmentStages { @StageRef VanillaChronicleHashHolder<?> hh; @StageRef HashSegmentIteration it; @StageRef HashLookupSearch hls; /** * During iteration, nextTier() is called in doReplaceValue() -> relocation() -> alloc(). * When the entry is rel...
// this check is relevant only for query contexts
356
14
370
<methods>public non-sealed void <init>() ,public long allocReturnCode(int) ,public int changeAndGetLatestSameThreadSegmentModCount(int) ,public int changeAndGetTotalReadLockCount(int) ,public int changeAndGetTotalUpdateLockCount(int) ,public int changeAndGetTotalWriteLockCount(int) ,public void checkIterationContextNot...
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/iter/SegmentsRecovery.java
SegmentsRecovery
zeroOutFirstSegmentTierCountersArea
class SegmentsRecovery implements IterationContext { @StageRef VanillaChronicleHashHolder<?> hh; @StageRef SegmentStages s; @StageRef TierRecovery tierRecovery; @Override public void recoverSegments( ChronicleHashCorruption.Listener corruptionListener, Chronicle...
s.nextTierIndex(0); if (s.prevTierIndex() != 0) { report(corruptionListener, corruption, s.segmentIndex, () -> format("stored prev tier index in first tier of segment {}: {}, should be 0", s.segmentIndex, s.prevTierIndex()) ); ...
1,660
364
2,024
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/query/HashQuery.java
HashQuery
tieredEntryPresent
class HashQuery<K> implements SetEntry<K> { @StageRef public VanillaChronicleHashHolder<K> hh; final DataAccess<K> innerInputKeyDataAccess = hh.h().keyDataAccess.copy(); @StageRef public SegmentStages s; @StageRef public HashEntryStages<K> entry; @StageRef public HashLookupSearch ha...
int firstTier = s.tier; long firstTierBaseAddr = s.tierBaseAddr; while (true) { if (s.hasNextTier()) { s.nextTier(); } else { if (s.tier != 0) s.initSegmentTier(); // loop to the root tier } if (...
849
194
1,043
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/query/KeySearch.java
KeySearch
initKeySearch
class KeySearch<K> { @StageRef public SegmentStages s; @StageRef public HashLookupSearch hashLookupSearch; @StageRef public HashEntryStages<K> entry; public Data<K> inputKey = null; @Stage("KeySearch") protected SearchState searchState = null; @StageRef VanillaChronicleMapHo...
for (long pos; (pos = hashLookupSearch.nextPos()) >= 0L; ) { // otherwise we are inside iteration relocation. // During iteration, key search occurs when doReplaceValue() exhausts space in // the current segment, and insertion into the tiered segment requires to locate ...
343
259
602
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/query/QueryAlloc.java
QueryAlloc
alloc
class QueryAlloc implements Alloc { @StageRef public SegmentStages s; @Override public long alloc(int chunks, long prevPos, int prevChunks) {<FILL_FUNCTION_BODY>} }
long ret = s.allocReturnCode(chunks); if (prevPos >= 0) s.free(prevPos, prevChunks); if (ret >= 0) return ret; int alreadyAttemptedTier = s.tier; s.goToFirstTier(); while (true) { if (s.tier != alreadyAttemptedTier) { r...
63
142
205
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/stage/query/SearchAllocatedChunks.java
SearchAllocatedChunks
initEntryAndKey
class SearchAllocatedChunks extends AllocatedChunks { @StageRef KeySearch<?> ks; /** * @return {@code true} if tier has changed */ public boolean initEntryAndKey(long entrySize) {<FILL_FUNCTION_BODY>} }
initAllocatedChunks(hh.h().inChunks(entrySize)); int tierBeforeAllocation = s.tier; long pos = alloc.alloc(allocatedChunks, -1, 0); entry.writeNewEntry(pos, ks.inputKey); return s.tier != tierBeforeAllocation;
80
87
167
<methods>public non-sealed void <init>() ,public void initAllocatedChunks(int) ,public boolean initEntryAndKeyCopying(long, long, long, int) <variables>public net.openhft.chronicle.hash.impl.stage.entry.Alloc alloc,public int allocatedChunks,public HashEntryStages<?> entry,public VanillaChronicleHashHolder<?> hh,public...
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/util/BuildVersion.java
BuildVersion
getVersionFromPom
class BuildVersion { private static String version = null; private BuildVersion() { } public static void main(String[] args) { System.out.println(version()); } /** * @return version of ChronicleMap being used, or NULL if its not known */ public synchronized static Strin...
final String absolutePath = new File(BuildVersion.class.getResource(BuildVersion.class .getSimpleName() + ".class").getPath()) .getParentFile().getParentFile().getParentFile().getParentFile().getParentFile() .getParentFile().getParentFile().getAbsolutePath(); ...
500
240
740
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/util/CharSequences.java
CharSequences
equivalent
class CharSequences { private CharSequences() { } public static boolean equivalent(@NotNull CharSequence a, @NotNull CharSequence b) {<FILL_FUNCTION_BODY>} public static int hash(@NotNull CharSequence cs) { if (cs instanceof String) return cs.hashCode(); int h = 0; ...
if (a.equals(b)) return true; if (a instanceof String) return ((String) a).contentEquals(b); if (b instanceof String) return ((String) b).contentEquals(a); int len = a.length(); if (len != b.length()) return false; for (int...
145
135
280
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/util/CleanerUtils.java
CleanerUtils
doClean
class CleanerUtils { private static final Method CREATE_METHOD; private static final Method CLEAN_METHOD; static { try { Class<?> cleanerClass = Class.forName(Jvm.isJava9Plus() ? "jdk.internal.ref.Cleaner" : "sun.misc.Cleaner"); CREATE_METHOD = cleanerClass.getDeclaredMetho...
try { CLEAN_METHOD.invoke(cleanerInstance); } catch (IllegalAccessException | InvocationTargetException e) { Jvm.warn().on(CleanerUtils.class, "Failed to clean buffer", e); }
355
64
419
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/util/FileIOUtils.java
FileIOUtils
readFully
class FileIOUtils { private FileIOUtils() { } public static void readFully(FileChannel fileChannel, long filePosition, ByteBuffer buffer) throws IOException {<FILL_FUNCTION_BODY>} public static void writeFully(FileChannel fileChannel, long filePosition, ByteBuffer buffer) thro...
int startBufferPosition = buffer.position(); while (buffer.remaining() > 0 && buffer.position() < fileChannel.size()) { int bytesRead = fileChannel.read(buffer, filePosition + buffer.position() - startBufferPosition); if (bytesRead == -1) ...
139
83
222
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/util/Objects.java
Objects
builderEquals
class Objects { private Objects() { } public static int hash(Object... values) { return Arrays.hashCode(values); } public static boolean equal(@Nullable Object a, @Nullable Object b) { return a != null ? a.equals(b) : b == null; } public static boolean builderEquals(@NotNu...
return builder == o || o != null && builder.getClass() == o.getClass() && builder.toString().equals(o.toString());
148
41
189
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/util/Throwables.java
Throwables
returnOrSuppress
class Throwables { private Throwables() { } public static RuntimeException propagate(Throwable t) { // Avoid calling Objects.requireNonNull(), StackOverflowError-sensitive if (t == null) throw new NullPointerException(); if (t instanceof Error) throw (Error)...
if (thrown == null) { return t; } else { if (t != null) thrown.addSuppressed(t); return thrown; }
295
50
345
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/util/jna/PosixFallocate.java
PosixFallocate
fallocate
class PosixFallocate { private PosixFallocate() { } public static void fallocate(FileDescriptor descriptor, long offset, long length) throws IOException {<FILL_FUNCTION_BODY>} private static int getNativeFileDescriptor(FileDescriptor descriptor) throws IOException { try { final Fi...
int fd = getNativeFileDescriptor(descriptor); if (fd != -1) { int ret = PosixAPI.posix().fallocate(getNativeFileDescriptor(descriptor), 0, offset, length); if (ret != 0) { throw new IOException("posix_fallocate() returned " + ret); } }
153
93
246
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/util/math/ContinuedFraction.java
ContinuedFraction
evaluate
class ContinuedFraction { /** * Access the n-th a coefficient of the continued fraction. Since a can be * a function of the evaluation point, x, that is passed in as well. * * @param n the coefficient index to retrieve. * @param x the evaluation point. * @return the n-th a coefficien...
final double small = 1e-50; double hPrev = getA(0, x); // use the value of small as epsilon criteria for zero checks if (Precision.isEquals(hPrev, 0.0, small)) { hPrev = small; } int n = 1; double dPrev = 0.0; double cPrev = hPrev; d...
599
491
1,090
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/util/math/PoissonDistribution.java
PoissonDistribution
solveInverseCumulativeProbability
class PoissonDistribution { private static final double EPSILON = 1e-12; /** * Poisson distribution is used to estimate segment fillings. Segments are not bound with * Integer.MAX_VALUE, but it's not clear if algorithms from Commons Math could work with such * big values as Long.MAX_VALUES ...
while (lower + 1 < upper) { long xm = (lower + upper) / 2; if (xm < lower || xm > upper) { /* * Overflow. * There will never be an overflow in both calculation methods * for xm at the same time */ ...
1,285
156
1,441
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/impl/util/math/Precision.java
Precision
isEquals
class Precision { /** * Offset to order signed double numbers lexicographically. */ private static final long SGN_MASK = 0x8000000000000000L; /** * Positive zero bits. */ private static final long POSITIVE_ZERO_DOUBLE_BITS = Double.doubleToRawLongBits(+0.0); /** * Negative ...
final long xInt = Double.doubleToRawLongBits(x); final long yInt = Double.doubleToRawLongBits(y); final boolean isEqual; if (((xInt ^ yInt) & SGN_MASK) == 0L) { // number have same sign, there is no risk of overflow isEqual = Math.abs(xInt - yInt) <= maxUlps; ...
624
332
956
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/replication/DefaultEventualConsistencyStrategy.java
DefaultEventualConsistencyStrategy
decideOnRemoteModification
class DefaultEventualConsistencyStrategy { private DefaultEventualConsistencyStrategy() { } /** * Returns the acceptance decision, should be made about the modification operation in the * given {@code context}, aiming to modify the given {@code entry}. This method doesn't do any * changes t...
long remoteTimestamp = context.remoteTimestamp(); long originTimestamp = entry.originTimestamp(); // Last write wins if (remoteTimestamp > originTimestamp) return ACCEPT; if (remoteTimestamp < originTimestamp) return DISCARD; // remoteTimestamp ==...
351
418
769
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/replication/TimeProvider.java
TimeProvider
systemTimeIntervalBetween
class TimeProvider { private static final AtomicLong lastTimeHolder = new AtomicLong(); private static LongSupplier millisecondSupplier = System::currentTimeMillis; private TimeProvider() { } /** * Returns a non-decreasing number, assumed to be used as a "timestamp". * <p> * Approx...
long intervalNanos = laterTime - earlierTime; return systemTimeIntervalUnit.convert(intervalNanos, NANOSECONDS);
549
39
588
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/ListMarshaller.java
ListMarshaller
read
class ListMarshaller<T> implements BytesReader<List<T>>, BytesWriter<List<T>>, StatefulCopyable<ListMarshaller<T>> { // Config fields private BytesReader<T> elementReader; private BytesWriter<? super T> elementWriter; /** * Constructs a {@code ListMarshaller} with the given list elements'...
int size = in.readInt(); if (using == null) { using = new ArrayList<>(size); for (int i = 0; i < size; i++) { using.add(null); } } else if (using.size() < size) { while (using.size() < size) { using.add(null); ...
970
175
1,145
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/MapMarshaller.java
MapMarshaller
read
class MapMarshaller<K, V> implements BytesReader<Map<K, V>>, BytesWriter<Map<K, V>>, StatefulCopyable<MapMarshaller<K, V>> { // Config fields private BytesReader<K> keyReader; private BytesWriter<? super K> keyWriter; private BytesReader<V> valueReader; private BytesWriter<? super V> valueW...
int size = in.readInt(); if (using == null) { using = new HashMap<>(((int) (size / 0.75))); for (int i = 0; i < size; i++) { using.put(keyReader.read(in, null), valueReader.read(in, null)); } } else { using.forEach((k, v) -> { ...
780
220
1,000
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/SetMarshaller.java
SetMarshaller
read
class SetMarshaller<T> implements BytesReader<Set<T>>, BytesWriter<Set<T>>, StatefulCopyable<SetMarshaller<T>> { // Config fields private BytesReader<T> elementReader; private BytesWriter<? super T> elementWriter; /** * Cache field */ private transient Deque<T> orderedElements; ...
int size = in.readInt(); if (using == null) { using = new HashSet<>((int) (size / 0.75)); for (int i = 0; i < size; i++) { using.add(elementReader.read(in, null)); } } else { orderedElements.addAll(using); using.clear()...
952
163
1,115
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/ByteArrayDataAccess.java
ByteArrayDataAccess
getUsing
class ByteArrayDataAccess extends AbstractData<byte[]> implements DataAccess<byte[]> { /** * Cache field */ private transient BytesStore<?, ?> bs; /** * State field */ private transient byte[] array; public ByteArrayDataAccess() { initTransients(); } private v...
if (using == null || using.length != array.length) using = new byte[array.length]; System.arraycopy(array, 0, using, 0, array.length); return using;
439
57
496
<methods>public boolean equals(java.lang.Object) ,public int hashCode() ,public java.lang.String toString() <variables>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/ByteArraySizedReader.java
ByteArraySizedReader
read
class ByteArraySizedReader implements SizedReader<byte[]>, EnumMarshallable<ByteArraySizedReader> { public static final ByteArraySizedReader INSTANCE = new ByteArraySizedReader(); private ByteArraySizedReader() { } @NotNull @Override public byte[] read(@NotNull Bytes in, long size, @N...
if (size < 0L || size > (long) Integer.MAX_VALUE) { throw new IORuntimeException("byte[] size should be non-negative int, " + size + " given. Memory corruption?"); } int arrayLength = (int) size; if (using == null || arrayLength != using.length) ...
144
109
253
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/ByteBufferDataAccess.java
ByteBufferDataAccess
getData
class ByteBufferDataAccess extends AbstractData<ByteBuffer> implements DataAccess<ByteBuffer> { // Cache fields private transient VanillaBytes<Void> bytes; // State fields private transient ByteBuffer bb; private transient BytesStore bytesStore; public ByteBufferDataAccess() { ...
bb = instance; ByteOrder originalOrder = instance.order(); bytesStore = BytesStore.follow(instance); instance.order(originalOrder); return this;
507
48
555
<methods>public boolean equals(java.lang.Object) ,public int hashCode() ,public java.lang.String toString() <variables>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/ByteBufferSizedReader.java
ByteBufferSizedReader
read
class ByteBufferSizedReader implements SizedReader<ByteBuffer>, EnumMarshallable<ByteBufferSizedReader> { public static final ByteBufferSizedReader INSTANCE = new ByteBufferSizedReader(); private ByteBufferSizedReader() { } @NotNull @Override public ByteBuffer read(@NotNull Bytes in, l...
if (size < 0L || size > (long) Integer.MAX_VALUE) throw new IllegalArgumentException("ByteBuffer size should be non-negative int, " + size + " given. Memory corruption?"); int bufferCap = (int) size; if (using == null || using.capacity() < bufferCap) { ...
143
140
283
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/ByteableDataAccess.java
ByteableDataAccess
getUsing
class ByteableDataAccess<T extends Byteable> extends InstanceCreatingMarshaller<T> implements DataAccess<T>, Data<T> { /** * State field */ private transient T instance; public ByteableDataAccess(Type tClass) { super(tClass); } @Override public RandomDataInput bytes(...
if (using == null) using = createInstance(); using.bytesStore(instance.bytesStore(), offset(), size()); return using;
363
39
402
<methods>public void readMarshallable(net.openhft.chronicle.wire.WireIn) ,public void writeMarshallable(net.openhft.chronicle.wire.WireOut) <variables>private java.lang.reflect.Type tClass
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/ByteableSizedReader.java
ByteableSizedReader
read
class ByteableSizedReader<T extends Byteable> extends InstanceCreatingMarshaller<T> implements SizedReader<T> { public ByteableSizedReader(Class<T> tClass) { super(tClass); } @NotNull @Override public final T read(@NotNull Bytes in, long size, @Nullable T using) {<FILL_FUNCTION_BOD...
if (using == null) using = createInstance(); using.bytesStore(in.bytesStore(), in.readPosition(), size); return using;
106
42
148
<methods>public void readMarshallable(net.openhft.chronicle.wire.WireIn) ,public void writeMarshallable(net.openhft.chronicle.wire.WireOut) <variables>private java.lang.reflect.Type tClass
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/BytesAsSizedReader.java
BytesAsSizedReader
copy
class BytesAsSizedReader<T> implements SizedReader<T>, StatefulCopyable<BytesAsSizedReader<T>> { /** * Config field */ private BytesReader<T> reader; public BytesAsSizedReader(BytesReader<T> reader) { this.reader = reader; } @NotNull @Override public T read(Bytes...
if (reader instanceof StatefulCopyable) { return new BytesAsSizedReader<>(StatefulCopyable.copyIfNeeded(reader)); } else { return this; }
251
52
303
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/BytesMarshallableDataAccess.java
BytesMarshallableDataAccess
initBytes
class BytesMarshallableDataAccess<T extends BytesMarshallable> extends InstanceCreatingMarshaller<T> implements DataAccess<T>, Data<T> { // Cache fields private transient boolean bytesInit; private transient Bytes bytes; private transient VanillaBytes targetBytes; /** * State field ...
if (!bytesInit) { bytes.clear(); instance.writeMarshallable(bytes); bytesInit = true; }
771
38
809
<methods>public void readMarshallable(net.openhft.chronicle.wire.WireIn) ,public void writeMarshallable(net.openhft.chronicle.wire.WireOut) <variables>private java.lang.reflect.Type tClass
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/BytesMarshallableReader.java
BytesMarshallableReader
read
class BytesMarshallableReader<T extends BytesMarshallable> extends InstanceCreatingMarshaller<T> implements SizedReader<T>, BytesReader<T> { public BytesMarshallableReader(Class<T> tClass) { super(tClass); } @NotNull @Override public T read(@NotNull Bytes in, long size, @Nullable T...
if (using == null) using = createInstance(); using.readMarshallable(in); return using;
153
34
187
<methods>public void readMarshallable(net.openhft.chronicle.wire.WireIn) ,public void writeMarshallable(net.openhft.chronicle.wire.WireOut) <variables>private java.lang.reflect.Type tClass
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/BytesMarshallableReaderWriter.java
BytesMarshallableReaderWriter
read
class BytesMarshallableReaderWriter<V extends BytesMarshallable> extends CachingCreatingMarshaller<V> { private static final ThreadLocal<VanillaBytes> VANILLA_BYTES_TL = ThreadLocal.withInitial(VanillaBytes::vanillaBytes); public BytesMarshallableReaderWriter(Class<V> vClass) { super(vClass); ...
if (using == null) using = createInstance(); VanillaBytes vanillaBytes = VANILLA_BYTES_TL.get(); vanillaBytes.bytesStore(in.bytesStore(), in.readPosition(), size); using.readMarshallable(vanillaBytes); return using;
184
78
262
<methods>public void <init>(Class<V>) ,public long size(V) ,public void write(Bytes#RAW, long, V) <variables>static final ThreadLocal<java.lang.Object> LAST_TL,static final ThreadLocal<net.openhft.chronicle.wire.Wire> WIRE_TL
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/BytesSizedMarshaller.java
BytesSizedMarshaller
read
class BytesSizedMarshaller implements SizedReader<Bytes<?>>, SizedWriter<Bytes<?>> { @Override public Bytes<?> read(Bytes in, long size, Bytes<?> using) {<FILL_FUNCTION_BODY>} @Override public long size(Bytes<?> toWrite) { return toWrite.readRemaining(); } @Override public void wri...
final int size0 = Maths.toInt32(size); if (using == null) using = Bytes.allocateElasticOnHeap(size0); in.read(using, size0); return using;
148
63
211
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/CachingCreatingMarshaller.java
CachingCreatingMarshaller
write
class CachingCreatingMarshaller<V> extends InstanceCreatingMarshaller<V> implements SizedReader<V>, SizedWriter<V> { static final ThreadLocal<Wire> WIRE_TL = ThreadLocal.withInitial( () -> WireType.BINARY_LIGHT.apply(Bytes.allocateElasticOnHeap(128))); static final ThreadLocal<Objec...
if (LAST_TL.get() == toWrite) { Wire wire = WIRE_TL.get(); if (wire.bytes().readRemaining() == size) { out.write(wire.bytes()); wire.bytes().clear(); LAST_TL.remove(); return; } } BinaryWire wire...
282
124
406
<methods>public void readMarshallable(net.openhft.chronicle.wire.WireIn) ,public void writeMarshallable(net.openhft.chronicle.wire.WireOut) <variables>private java.lang.reflect.Type tClass
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/CharSequenceBytesReader.java
CharSequenceBytesReader
read
class CharSequenceBytesReader implements BytesReader<CharSequence>, StatefulCopyable<CharSequenceBytesReader>, EnumMarshallable<CharSequenceBytesReader> { public static final CharSequenceBytesReader INSTANCE = new CharSequenceBytesReader(); private CharSequenceBytesReader() { } @NotNull @O...
StringBuilder usingSB; if (using instanceof StringBuilder) { usingSB = (StringBuilder) using; } else { usingSB = new StringBuilder(); } if (in.readUtf8(usingSB)) { return usingSB; } else { throw new NullPointerException("By...
168
93
261
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/CharSequenceSizedReader.java
CharSequenceSizedReader
read
class CharSequenceSizedReader implements SizedReader<CharSequence>, StatefulCopyable<CharSequenceSizedReader>, ReadResolvable<CharSequenceSizedReader> { public static final CharSequenceSizedReader INSTANCE = new CharSequenceSizedReader(); private CharSequenceSizedReader() { } @NotNull @Ov...
if (0 > size || size > Integer.MAX_VALUE) throw new IllegalStateException("positive int size expected, " + size + " given"); int csLen = (int) size; StringBuilder usingSB; if (using instanceof StringBuilder) { usingSB = ((StringBuilder) using); usingS...
247
147
394
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/CharSequenceUtf8DataAccess.java
CharSequenceUtf8DataAccess
getUsing
class CharSequenceUtf8DataAccess extends AbstractCharSequenceUtf8DataAccess<CharSequence> { public CharSequenceUtf8DataAccess() { this(DefaultElasticBytes.DEFAULT_BYTES_CAPACITY); } private CharSequenceUtf8DataAccess(long bytesCapacity) { super(bytesCapacity); } @Override ...
StringBuilder sb; if (using instanceof StringBuilder) { sb = (StringBuilder) using; sb.setLength(0); } else { sb = new StringBuilder(cs.length()); } sb.append(cs); return sb;
160
71
231
<methods>public net.openhft.chronicle.bytes.RandomDataInput bytes() ,public java.lang.CharSequence get() ,public Data<java.lang.CharSequence> getData(java.lang.CharSequence) ,public long offset() ,public void readMarshallable(net.openhft.chronicle.wire.WireIn) ,public long size() ,public void uninit() ,public void writ...
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/CommonMarshallableReaderWriter.java
CommonMarshallableReaderWriter
read
class CommonMarshallableReaderWriter<V extends CommonMarshallable> extends CachingCreatingMarshaller<V> { public CommonMarshallableReaderWriter(Class<V> vClass) { super(vClass); } @NotNull @Override public V read(Bytes in, long size, @Nullable V using) {<FILL_FUNCTION_BODY>} @...
if (using == null) using = createInstance(); if (using.usesSelfDescribingMessage()) { ((ReadMarshallable) using).readMarshallable(Wires.binaryWireForRead(in, in.readPosition(), size)); } else { ((ReadBytesMarshallable) using).readMarshallable(in); } ...
190
96
286
<methods>public void <init>(Class<V>) ,public long size(V) ,public void write(Bytes#RAW, long, V) <variables>static final ThreadLocal<java.lang.Object> LAST_TL,static final ThreadLocal<net.openhft.chronicle.wire.Wire> WIRE_TL
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/ConstantSizeMarshaller.java
ConstantSizeMarshaller
writeSize
class ConstantSizeMarshaller implements SizeMarshaller { /** * Config field */ private long constantSize; public ConstantSizeMarshaller(long constantSize) { this.constantSize = constantSize; } @Override public int storingLength(long size) { return 0; } @Over...
if (sizeToWrite != constantSize) { throw new IllegalArgumentException( "sizeToWrite: " + sizeToWrite + ", constant size should be: " + constantSize); } // do nothing
357
55
412
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/DefaultElasticBytes.java
DefaultElasticBytes
allocateDefaultElasticBytes
class DefaultElasticBytes { static final int DEFAULT_BYTES_CAPACITY = 32; private DefaultElasticBytes() { } static Bytes<?> allocateDefaultElasticBytes(long bytesCapacity) {<FILL_FUNCTION_BODY>} }
if (bytesCapacity <= 0x7FFFFFF0) { return Bytes.elasticHeapByteBuffer((int) bytesCapacity); } else { return Bytes.allocateElasticDirect(bytesCapacity); }
75
61
136
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/DoubleDataAccess.java
DoubleDataAccess
bytes
class DoubleDataAccess extends AbstractData<Double> implements DataAccess<Double>, Data<Double> { // Cache fields private transient boolean bsInit; private transient BytesStore bs; /** * State field */ private transient Double instance; public DoubleDataAccess() { in...
if (!bsInit) { bs.writeDouble(0, instance); bsInit = true; } return bs;
519
40
559
<methods>public boolean equals(java.lang.Object) ,public int hashCode() ,public java.lang.String toString() <variables>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/ExternalBytesMarshallableDataAccess.java
ExternalBytesMarshallableDataAccess
readMarshallable
class ExternalBytesMarshallableDataAccess<T> extends InstanceCreatingMarshaller<T> implements DataAccess<T>, Data<T> { // Config fields private SizedReader<T> reader; private BytesWriter<? super T> writer; /** * Cache field */ private transient Bytes bytes; /** * State ...
super.readMarshallable(wireIn); reader = wireIn.read(() -> "reader").typedMarshallable(); writer = wireIn.read(() -> "writer").typedMarshallable(); initTransients(DEFAULT_BYTES_CAPACITY);
760
69
829
<methods>public void readMarshallable(net.openhft.chronicle.wire.WireIn) ,public void writeMarshallable(net.openhft.chronicle.wire.WireOut) <variables>private java.lang.reflect.Type tClass
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/ExternalizableDataAccess.java
ExternalizableDataAccess
createInstance
class ExternalizableDataAccess<T extends Externalizable> extends SerializableDataAccess<T> { /** * Config field */ private Class<T> tClass; public ExternalizableDataAccess(Class<T> tClass) { this(tClass, DEFAULT_BYTES_CAPACITY); } private ExternalizableDataAccess(Class<T> tClass...
try { return tClass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeException( "Externalizable " + tClass + " must have a public no-arg constructor", e); }
501
64
565
<methods>public void <init>() ,public net.openhft.chronicle.bytes.RandomDataInput bytes() ,public DataAccess<T> copy() ,public T get() ,public Data<T> getData(T) ,public T getUsing(T) ,public long offset() ,public void readMarshallable(net.openhft.chronicle.wire.WireIn) ,public long size() ,public void uninit() ,public...
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/ExternalizableReader.java
ExternalizableReader
read
class ExternalizableReader<T extends Externalizable> extends InstanceCreatingMarshaller<T> implements SizedReader<T>, BytesReader<T> { public ExternalizableReader(Class<T> tClass) { super(tClass); } @NotNull @Override public T read(@NotNull Bytes in, long size, @Nullable T using) {...
if (using == null) using = createInstance(); try { using.readExternal(new ObjectInputStream(in.inputStream())); return using; } catch (IOException | ClassNotFoundException e) { throw new RuntimeException(e); }
147
68
215
<methods>public void readMarshallable(net.openhft.chronicle.wire.WireIn) ,public void writeMarshallable(net.openhft.chronicle.wire.WireOut) <variables>private java.lang.reflect.Type tClass
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/InstanceCreatingMarshaller.java
InstanceCreatingMarshaller
createInstance
class InstanceCreatingMarshaller<T> implements Marshallable { private Type tClass; /** * Constructor for use in subclasses. * * @param tClass the class of objects deserialized */ protected InstanceCreatingMarshaller(Class<T> tClass) { this.tClass = tClass; } protected ...
try { return ObjectUtils.newInstance(tClass()); } catch (Exception e) { throw new IllegalStateException("Some of default marshallers, chosen for the type\n" + tClass + " by default, delegate to \n" + this.getClass().getName() + " which ass...
444
240
684
<no_super_class>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/IntegerDataAccess_3_13.java
IntegerDataAccess_3_13
bytes
class IntegerDataAccess_3_13 extends AbstractData<Integer> implements DataAccess<Integer>, Data<Integer> { // Cache fields private transient boolean bsInit; private transient BytesStore bs; /** * State field */ private transient Integer instance; public IntegerDataAccess_3_1...
if (!bsInit) { bs.writeInt(0, instance); bsInit = true; } return bs;
516
40
556
<methods>public boolean equals(java.lang.Object) ,public int hashCode() ,public java.lang.String toString() <variables>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/LongDataAccess.java
LongDataAccess
bytes
class LongDataAccess extends AbstractData<Long> implements DataAccess<Long>, Data<Long> { // Cache fields private transient boolean bsInit; private transient BytesStore bs; /** * State field */ private transient Long instance; public LongDataAccess() { initTransients...
if (!bsInit) { bs.writeLong(0, instance); bsInit = true; } return bs;
501
40
541
<methods>public boolean equals(java.lang.Object) ,public int hashCode() ,public java.lang.String toString() <variables>
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/MarshallableReaderWriter.java
MarshallableReaderWriter
read
class MarshallableReaderWriter<V extends Marshallable> extends CachingCreatingMarshaller<V> { public MarshallableReaderWriter(Class<V> vClass) { super(vClass); } @NotNull @Override public V read(Bytes in, long size, @Nullable V using) {<FILL_FUNCTION_BODY>} @Override protec...
if (using == null) using = createInstance(); using.readMarshallable(Wires.binaryWireForRead(in, in.readPosition(), size)); return using;
133
51
184
<methods>public void <init>(Class<V>) ,public long size(V) ,public void write(Bytes#RAW, long, V) <variables>static final ThreadLocal<java.lang.Object> LAST_TL,static final ThreadLocal<net.openhft.chronicle.wire.Wire> WIRE_TL
OpenHFT_Chronicle-Map
Chronicle-Map/src/main/java/net/openhft/chronicle/hash/serialization/impl/SerializableDataAccess.java
SerializableDataAccess
getUsing
class SerializableDataAccess<T extends Serializable> extends AbstractData<T> implements DataAccess<T> { // Cache fields transient Bytes bytes; transient OutputStream out; transient InputStream in; /** * State field */ transient T instance; public SerializableDataAccess()...
try { T result = (T) new ObjectInputStream(in).readObject(); bytes.readPosition(0); return result; } catch (IOException | ClassNotFoundException e) { throw new RuntimeException(e); }
543
63
606
<methods>public boolean equals(java.lang.Object) ,public int hashCode() ,public java.lang.String toString() <variables>