Created
July 28, 2011 17:58
-
-
Save riferrei/1112113 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.oracle.coherence.demo; | |
import com.tangosol.net.CacheFactory; | |
import com.tangosol.net.NamedCache; | |
public class GravarPIUsandoCoherence { | |
public static void main(String[] args) throws Exception { | |
// Garante que este programa faça parte do grid... | |
CacheFactory.ensureCluster(); | |
// Solicita ao Coherence a criação de um cache... | |
NamedCache constantes = CacheFactory.getCache("constantes"); | |
// Insere o valor da constante PI no cache... | |
constantes.put("pi", 3.14); | |
// Aguarda 1 minuto até que outro membro entre no | |
// grid e leia a variável PI... | |
Thread.sleep(60000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment