type below:
brew update
brew install redis
To have launchd start redis now and restart at login:
brew services start redis
| 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; |
type below:
brew update
brew install redis
To have launchd start redis now and restart at login:
brew services start redis
| 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); | |
| } |
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