Skip to content

Instantly share code, notes, and snippets.

View duqicauc's full-sized avatar
🎯
Focusing

阿杜 duqicauc

🎯
Focusing
View GitHub Profile
@ufuk
ufuk / ApplicationContextHolder.java
Last active December 17, 2022 14:16 — forked from baybatu/getting-spring-bean-from-unmanaged-area.java
Utility bean for getting Spring beans from static context.
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class ApplicationContextHolder implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@tomysmile
tomysmile / mac-setup-redis.md
Last active March 18, 2024 22:12
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@shelajev
shelajev / Main.java
Last active January 10, 2020 08:56
IterateOverHeap JVMTI example
package org.shelajev;
public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
Thread t = new Thread();
int a = countInstances(Thread.class);
System.out.println("There are " + a + " instances of " + Thread.class);
}
@rednaxelafx
rednaxelafx / Notes.md
Created December 12, 2011 06:40
Java 7's GC notification notes

GC notifications are sent to the ServiceThread, as shown in the Groovy shell example in this gist. The ServiceThread is a JavaThread, so it can execute Java code.

To see GC notification in action, refer to a conversation in hotspot-gc-dev. Another thread of interest is the discussions on 7110173: GCNotifier::pushNotification publishes stale data.

In the HotSpot VM, GC notifications are pushed with GCNotifier::pushNotification(), in GCMemoryManager::gc_end(), which is in turn called by MemoryService::gc_end().

hotspot/src/share/vm/runtime/serviceThread.cpp