{"id":1828,"date":"2014-12-17T16:21:28","date_gmt":"2014-12-17T16:21:28","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=1828"},"modified":"2023-06-27T23:16:55","modified_gmt":"2023-06-28T06:16:55","slug":"whats-new-couchbase-java-sdk-12","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/pt\/whats-new-couchbase-java-sdk-12\/","title":{"rendered":"O que h\u00e1 de novo no Couchbase Java SDK 1.2"},"content":{"rendered":"<p><em style=\"line-height: 23px;font-family: ff-meta-serif-web-pro-1, ff-meta-serif-web-pro-2, Georgia, 'Times New Roman', Times, serif\">[Este blog foi distribu\u00eddo pelo site https:\/\/nitschinger.at\/].<\/em><\/p>\n<p>Para todos os usu\u00e1rios do nosso Java SDK, preparamos algumas adi\u00e7\u00f5es interessantes para voc\u00ea. Esta postagem os aborda em detalhes e mostra como voc\u00ea pode se tornar mais produtivo<\/p>\n<p>Observe que esta publica\u00e7\u00e3o do blog pressup\u00f5e que voc\u00ea esteja executando a vers\u00e3o 1.2.1, pois houve algumas pequenas altera\u00e7\u00f5es entre a 1.2.0 e a 1.2.1 que afetam, por exemplo, o suporte a ouvintes e a coleta de m\u00e9tricas.<\/p>\n<h2>Distribui\u00e7\u00e3o central do Maven<\/h2>\n<p>Da vers\u00e3o 1.2.0 em diante, o Java SDK \u00e9 distribu\u00eddo diretamente do Maven Central. Isso significa que voc\u00ea n\u00e3o precisa mais incluir o reposit\u00f3rio do Couchbase. O c\u00f3digo maven a seguir \u00e9 suficiente para come\u00e7ar (observe que o groupId foi alterado):<\/p>\n<div class=\"geshifilter\">\n<div class=\"xml geshifilter-xml\" style=\"font-family: monospace\"><span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&lt;depend\u00eancias<span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><\/span><br \/>\n<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&lt;depend\u00eancia<span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><\/span><br \/>\n<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&lt;groupId<span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><\/span>com.couchbase.client<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&lt;artifactId<span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><\/span>cliente couchbase<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&lt;vers\u00e3o<span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><\/span>1.2.1<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><\/div>\n<\/div>\n<p>Isso tamb\u00e9m carregar\u00e1 automaticamente a depend\u00eancia mais recente do spymemcached (para a vers\u00e3o 1.2.0, \u00e9 a 2.10.0). Antes de nos aprofundarmos no que mudou, <a href=\"https:\/\/docs.couchbase.com\/couchbase-sdk-java-1.2\/#release-notes-for-couchbase-client-library-java-120-ga-13-september-2013\">aqui<\/a>\u00a0s\u00e3o as notas de vers\u00e3o para uma refer\u00eancia r\u00e1pida.<\/p>\n<h2>Suporte ao ouvinte<\/h2>\n<div>At\u00e9 agora, havia duas maneiras de obter o resultado de uma solicita\u00e7\u00e3o ass\u00edncrona. Ou bloqueando o thread atual da seguinte forma:<\/div>\n<div><\/div>\n<div class=\"geshifilter\">\n<div class=\"java geshifilter-java\" style=\"font-family: monospace\"><span style=\"color: #666666;font-style: italic\">\/\/ fazer uma opera\u00e7\u00e3o ass\u00edncrona (retorna imediatamente)<\/span><br \/>\nOpera\u00e7\u00e3oFuturo<span style=\"color: #339933\">&lt;<\/span>Booleano<span style=\"color: #339933\">&gt;<\/span> setFuture <span style=\"color: #339933\">=<\/span> cliente.<span style=\"color: #006633\">definir<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #0000ff\">\"chave\"<\/span>, <span style=\"color: #0000ff\">\"valor\"<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/p>\n<p><span style=\"color: #666666;font-style: italic\">\/\/ bloquear o thread atual<\/span><br \/>\n<a href=\"https:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Aboolean+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky\"><span style=\"color: #003399\">Booleano<\/span><\/a> resultado <span style=\"color: #339933\">=<\/span> setFuture.<span style=\"color: #006633\">obter<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/div>\n<\/div>\n<div><\/div>\n<div>Ou para fazer um loop nos m\u00e9todos futuros sem bloqueio. Isso \u00e9 especialmente \u00fatil se voc\u00ea estiver lidando com uma lista de futuros.<\/div>\n<div><\/div>\n<div>\n<div class=\"geshifilter\">\n<div class=\"java geshifilter-java\" style=\"font-family: monospace\">Lista<span style=\"color: #339933\">&lt;<\/span>Opera\u00e7\u00e3oFuturo<span style=\"color: #339933\">&lt;<\/span>Booleano<span style=\"color: #339933\">&gt;&gt;<\/span> futuros <span style=\"color: #339933\">=<\/span> <span style=\"color: #000000;font-weight: bold\">novo<\/span> ArrayList<span style=\"color: #339933\">&lt;<\/span>Opera\u00e7\u00e3oFuturo<span style=\"color: #339933\">&lt;<\/span>Booleano<span style=\"color: #339933\">&gt;&gt;<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<span style=\"color: #000000;font-weight: bold\">para<\/span> <span style=\"color: #009900\">(<\/span><span style=\"color: #000066;font-weight: bold\">int<\/span> i <span style=\"color: #339933\">=<\/span> <span style=\"color: #cc66cc\">0<\/span><span style=\"color: #339933\">;<\/span> i <span style=\"color: #339933\">&lt;<\/span> <span style=\"color: #cc66cc\">100<\/span><span style=\"color: #339933\">;<\/span> i<span style=\"color: #339933\">++<\/span><span style=\"color: #009900\">)<\/span> <span style=\"color: #009900\">{<\/span><br \/>\nfuturos.<span style=\"color: #006633\">adicionar<\/span><span style=\"color: #009900\">(<\/span>cliente.<span style=\"color: #006633\">definir<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #0000ff\">\"chave-\"<\/span> <span style=\"color: #339933\">+<\/span> i, <span style=\"color: #0000ff\">\"valor\"<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<span style=\"color: #009900\">}<\/span><\/p>\n<p><span style=\"color: #000000;font-weight: bold\">enquanto<\/span> <span style=\"color: #009900\">(<\/span><span style=\"color: #339933\">!<\/span>futuros.<span style=\"color: #006633\">isEmpty<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #009900\">)<\/span> <span style=\"color: #009900\">{<\/span><br \/>\nIterador<span style=\"color: #339933\">&lt;<\/span>Opera\u00e7\u00e3oFuturo<span style=\"color: #339933\">&lt;<\/span>Booleano<span style=\"color: #339933\">&gt;&gt;<\/span> iter <span style=\"color: #339933\">=<\/span> futuros.<span style=\"color: #006633\">iterador<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<span style=\"color: #000000;font-weight: bold\">enquanto<\/span> <span style=\"color: #009900\">(<\/span>iter.<span style=\"color: #006633\">hasNext<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #009900\">)<\/span> <span style=\"color: #009900\">{<\/span><br \/>\nOpera\u00e7\u00e3oFuturo<span style=\"color: #339933\">&lt;<\/span>Booleano<span style=\"color: #339933\">&gt;<\/span> futuro <span style=\"color: #339933\">=<\/span> iter.<span style=\"color: #006633\">pr\u00f3xima<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<span style=\"color: #000000;font-weight: bold\">se<\/span> <span style=\"color: #009900\">(<\/span>futuro.<span style=\"color: #006633\">isDone<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #009900\">)<\/span> <span style=\"color: #009900\">{<\/span><br \/>\niter.<span style=\"color: #006633\">remover<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<span style=\"color: #009900\">}<\/span><br \/>\n<span style=\"color: #009900\">}<\/span><br \/>\n<span style=\"color: #009900\">}<\/span><\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<div>Agora, desde a vers\u00e3o 1.2.0, h\u00e1 uma nova maneira de lidar com as respostas: adicionar ouvintes. A ideia \u00e9 fornecer um retorno de chamada para o futuro que ser\u00e1 executado assim que a opera\u00e7\u00e3o for conclu\u00edda. Um exemplo simples \u00e9 mostrado aqui:<\/div>\n<div><\/div>\n<div>\n<div class=\"geshifilter\">\n<div class=\"java geshifilter-java\" style=\"font-family: monospace\">Opera\u00e7\u00e3oFuturo<span style=\"color: #339933\">&lt;<\/span>Booleano<span style=\"color: #339933\">&gt;<\/span> setFuture <span style=\"color: #339933\">=<\/span> cliente.<span style=\"color: #006633\">definir<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #0000ff\">\"chave\"<\/span>, <span style=\"color: #0000ff\">\"valor\"<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\nsetFuture.<span style=\"color: #006633\">addListener<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #000000;font-weight: bold\">novo<\/span> Listador de conclus\u00e3o de opera\u00e7\u00e3o (OperationCompletionListener)<span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span> <span style=\"color: #009900\">{<\/span><br \/>\n@Override<br \/>\n<span style=\"color: #000000;font-weight: bold\">p\u00fablico<\/span> <span style=\"color: #000066;font-weight: bold\">vazio<\/span> onComplete<span style=\"color: #009900\">(<\/span>Opera\u00e7\u00e3oFuturo<span style=\"color: #339933\">&lt;?&gt;<\/span> futuro<span style=\"color: #009900\">)<\/span> <span style=\"color: #000000;font-weight: bold\">lan\u00e7amentos<\/span> <a href=\"https:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky\"><span style=\"color: #003399\">Exce\u00e7\u00e3o<\/span><\/a> <span style=\"color: #009900\">{<\/span><br \/>\n<a href=\"https:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky\"><span style=\"color: #003399\">Sistema<\/span><\/a>.<span style=\"color: #006633\">fora<\/span>.<span style=\"color: #006633\">println<\/span><span style=\"color: #009900\">(<\/span>futuro.<span style=\"color: #006633\">obter<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<span style=\"color: #009900\">}<\/span><br \/>\n<span style=\"color: #009900\">}<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<div>Note that the `.get()` method on the future will not block anymore because the result is already computed. Whatever you put in the callback method will be executed asynchronously on the thread pool. To see how flexible that approach is, let&#8217;s rewrite the example from above waiting until the 100 futures are done.<\/div>\n<div><\/div>\n<div>\n<div class=\"geshifilter\">\n<div class=\"java geshifilter-java\" style=\"font-family: monospace\"><span style=\"color: #000000;font-weight: bold\">final<\/span> Trava CountDownLatch <span style=\"color: #339933\">=<\/span> <span style=\"color: #000000;font-weight: bold\">novo<\/span> CountDownLatch<span style=\"color: #009900\">(<\/span><span style=\"color: #cc66cc\">100<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<span style=\"color: #000000;font-weight: bold\">para<\/span> <span style=\"color: #009900\">(<\/span><span style=\"color: #000066;font-weight: bold\">int<\/span> i <span style=\"color: #339933\">=<\/span> <span style=\"color: #cc66cc\">0<\/span><span style=\"color: #339933\">;<\/span> i <span style=\"color: #339933\">&lt;<\/span> <span style=\"color: #cc66cc\">100<\/span><span style=\"color: #339933\">;<\/span> i<span style=\"color: #339933\">++<\/span><span style=\"color: #009900\">)<\/span> <span style=\"color: #009900\">{<\/span><br \/>\nOpera\u00e7\u00e3oFuturo<span style=\"color: #339933\">&lt;<\/span>Booleano<span style=\"color: #339933\">&gt;<\/span> futuro <span style=\"color: #339933\">=<\/span> cliente.<span style=\"color: #006633\">definir<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #0000ff\">\"chave-\"<\/span> <span style=\"color: #339933\">+<\/span> i, <span style=\"color: #0000ff\">\"valor\"<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\nfuturo.<span style=\"color: #006633\">addListener<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #000000;font-weight: bold\">novo<\/span> Listador de conclus\u00e3o de opera\u00e7\u00e3o (OperationCompletionListener)<span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span> <span style=\"color: #009900\">{<\/span><br \/>\n@Override<br \/>\n<span style=\"color: #000000;font-weight: bold\">p\u00fablico<\/span> <span style=\"color: #000066;font-weight: bold\">vazio<\/span> onComplete<span style=\"color: #009900\">(<\/span>Opera\u00e7\u00e3oFuturo<span style=\"color: #339933\">&lt;?&gt;<\/span> futuro<span style=\"color: #009900\">)<\/span> <span style=\"color: #000000;font-weight: bold\">lan\u00e7amentos<\/span> <a href=\"https:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Aexception+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky\"><span style=\"color: #003399\">Exce\u00e7\u00e3o<\/span><\/a> <span style=\"color: #009900\">{<\/span><br \/>\ntrava.<span style=\"color: #006633\">countDown<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<span style=\"color: #009900\">}<\/span><br \/>\n<span style=\"color: #009900\">}<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<span style=\"color: #009900\">}<\/span><br \/>\ntrava.<span style=\"color: #006633\">aguardar<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<div>Aqui estamos usando um <a href=\"https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/util\/concurrent\/CountDownLatch.html\">CountDownLatch<\/a>\u00a0que espera no thread atual desde que tenha sido contado cem vezes. Exatamente o que precisamos em nossa situa\u00e7\u00e3o, mas o c\u00f3digo \u00e9 muito mais f\u00e1cil de ler. E o mais importante \u00e9 que ele \u00e9 muito mais flex\u00edvel, pois outras coisas podem ser feitas, como disparar uma nova solicita\u00e7\u00e3o, consultar um servi\u00e7o da Web ou calcular um resultado.<\/div>\n<div><\/div>\n<div>It is also possible to override the default `ExecutorService` implementation with a custom one. This may be needed if the default behavior (Basically a upper-bounded cachedThreadPool) does not suite your needs. Also, you should use this approach if you create a bunch of `CouchbaseClient` instances so you can share the same service across all of them.<\/div>\n<div><\/div>\n<div>\n<div class=\"geshifilter\">\n<div class=\"java geshifilter-java\" style=\"font-family: monospace\"><span style=\"color: #666666;font-style: italic\">\/\/ Criar o Builder<\/span><br \/>\nConstrutor do CouchbaseConnectionFactoryBuilder <span style=\"color: #339933\">=<\/span> <span style=\"color: #000000;font-weight: bold\">novo<\/span> CouchbaseConnectionFactoryBuilder<span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/p>\n<p><span style=\"color: #666666;font-style: italic\">\/\/ Criar um pool de threads de 5 threads fixos<\/span><br \/>\nServi\u00e7o ExecutorService <span style=\"color: #339933\">=<\/span> Executores.<span style=\"color: #006633\">newFixedThreadPool<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #cc66cc\">5<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/p>\n<p><span style=\"color: #666666;font-style: italic\">\/\/ Definir no construtor<\/span><br \/>\nconstrutor.<span style=\"color: #006633\">setListenerExecutorService<\/span><span style=\"color: #009900\">(<\/span>servi\u00e7o<span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/p>\n<p><span style=\"color: #666666;font-style: italic\">\/\/ Criar a inst\u00e2ncia<\/span><br \/>\nCliente CouchbaseClient <span style=\"color: #339933\">=<\/span> <span style=\"color: #000000;font-weight: bold\">novo<\/span> Cliente Couchbase<span style=\"color: #009900\">(<\/span>construtor.<span style=\"color: #006633\">buildCouchbaseConnection<\/span><span style=\"color: #009900\">(<\/span>&#8230;<span style=\"color: #009900\">)<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/div>\n<\/div>\n<\/div>\n<h2>Recursos aprimorados de cria\u00e7\u00e3o de perfil<\/h2>\n<div>Obter insights sobre um aplicativo em execu\u00e7\u00e3o \u00e9 sempre dif\u00edcil, por isso nos propusemos a facilitar esse processo para voc\u00ea. Incorporamos uma biblioteca chamada metrics que cria perfis, dependendo do n\u00edvel de configura\u00e7\u00e3o escolhido.<\/div>\n<div><\/div>\n<div>Antes de poder us\u00e1-lo, voc\u00ea precisa adicionar essa depend\u00eancia opcional:<\/div>\n<div><\/div>\n<div class=\"geshifilter\">\n<div class=\"xml geshifilter-xml\" style=\"font-family: monospace\"><span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&lt;depend\u00eancia<span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><\/span><br \/>\n<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&lt;groupId<span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><\/span>com.codahale.metrics<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&lt;artifactId<span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><\/span>n\u00facleo de m\u00e9tricas<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&lt;vers\u00e3o<span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><\/span>3.0.1<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><br \/>\n<span style=\"color: #009900\"><span style=\"color: #000000;font-weight: bold\">&gt;<\/span><\/span><\/div>\n<\/div>\n<div><\/div>\n<div>No construtor, h\u00e1 um m\u00e9todo que permite que voc\u00ea ative o criador de perfil:<\/div>\n<div><\/div>\n<div class=\"geshifilter\">\n<div class=\"java geshifilter-java\" style=\"font-family: monospace\">Construtor do CouchbaseConnectionFactoryBuilder <span style=\"color: #339933\">=<\/span> <span style=\"color: #000000;font-weight: bold\">novo<\/span> CouchbaseConnectionFactoryBuilder<span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<span style=\"color: #666666;font-style: italic\">\/\/ ativar a coleta de m\u00e9tricas<\/span><br \/>\nconstrutor.<span style=\"color: #006633\">setEnableMetrics<\/span><span style=\"color: #009900\">(<\/span>MetricType.<span style=\"color: #006633\">DESEMPENHO<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/div>\n<\/div>\n<div><\/div>\n<div>If you look at the `MetricType` enumeration you can see that there are three types of values you can choose from: OFF (which keeps metric collection off), PERFORMANCE (which only collects performance-relevant metrics) and DEBUG (which collects all kinds of metrics, including the performance ones). While the metrics library is quite efficient, keep in mind that metric collection takes some resources away from your application.<\/div>\n<div><\/div>\n<div>Por padr\u00e3o, as informa\u00e7\u00f5es de m\u00e9tricas ser\u00e3o impressas no console a cada 30 segundos. Voc\u00ea pode executar o c\u00f3digo de teste a seguir em seu IDE e ver como fica:<\/div>\n<div><\/div>\n<div>\n<div class=\"geshifilter\">\n<div class=\"java geshifilter-java\" style=\"font-family: monospace\">Construtor do CouchbaseConnectionFactoryBuilder <span style=\"color: #339933\">=<\/span> <span style=\"color: #000000;font-weight: bold\">novo<\/span> CouchbaseConnectionFactoryBuilder<span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\nconstrutor.<span style=\"color: #006633\">setEnableMetrics<\/span><span style=\"color: #009900\">(<\/span>MetricType.<span style=\"color: #006633\">DESEMPENHO<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/p>\n<p>CouchbaseConnectionFactory cf <span style=\"color: #339933\">=<\/span><br \/>\nconstrutor.<span style=\"color: #006633\">buildCouchbaseConnection<\/span><span style=\"color: #009900\">(<\/span><a href=\"https:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Aarrays+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky\"><span style=\"color: #003399\">Matrizes<\/span><\/a>.<span style=\"color: #006633\">asList<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #000000;font-weight: bold\">novo<\/span> URI<span style=\"color: #009900\">(<\/span><span style=\"color: #0000ff\">\u201chttps:\/\/127.0.0.1:8091\/pools\u201d<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #009900\">)<\/span>, <span style=\"color: #0000ff\">\"default\"<\/span>, <span style=\"color: #0000ff\">&#8220;&#8221;<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\nCliente CouchbaseClient <span style=\"color: #339933\">=<\/span> <span style=\"color: #000000;font-weight: bold\">novo<\/span> Cliente Couchbase<span style=\"color: #009900\">(<\/span>cf<span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/p>\n<p><span style=\"color: #000000;font-weight: bold\">enquanto<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #000066;font-weight: bold\">verdadeiro<\/span><span style=\"color: #009900\">)<\/span> <span style=\"color: #009900\">{<\/span><br \/>\ncliente.<span style=\"color: #006633\">definir<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #0000ff\">\"foo\"<\/span>, <span style=\"color: #0000ff\">\"bar\"<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<a href=\"https:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Athread+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky\"><span style=\"color: #003399\">T\u00f3pico<\/span><\/a>.<span style=\"color: #006633\">dormir<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #cc66cc\">100<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<span style=\"color: #009900\">}<\/span><\/div>\n<\/div>\n<div><\/div>\n<\/div>\n<div>Agora aguarde 30 segundos e ver\u00e1 um resultado como este no console:<\/div>\n<div><\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace\">10\/8\/13 12:04:14 PM ============================================================<\/p>\n<p>- Histogramas ----------------------<\/p>\n<p>[M\u00e9dia de bytes lidos do sistema operacional por leitura<\/p>\n<p>contagem = 893<\/p>\n<p>min = 24<\/p>\n<p>max = 24<\/p>\n<p>m\u00e9dia = 24,00<\/p>\n<p>stddev = 0,00<\/p>\n<p>mediana = 24,00<\/p>\n<p>75% &lt;= 24,00<\/p>\n<p>95% &lt;= 24,00<\/p>\n<p>98% &lt;= 24,00<\/p>\n<p>99% &lt;= 24,00<\/p>\n<p>99,9% &lt;= 24,00<\/p>\n<p>[M\u00e9dia de bytes gravados no sistema operacional por grava\u00e7\u00e3o<\/p>\n<p>contagem = 893<\/p>\n<p>min = 38<\/p>\n<p>max = 38<\/p>\n<p>m\u00e9dia = 38,00<\/p>\n<p>stddev = 0,00<\/p>\n<p>mediana = 38,00<\/p>\n<p>75% &lt;= 38,00<\/p>\n<p>95% &lt;= 38,00<\/p>\n<p>98% &lt;= 38,00<\/p>\n<p>99% &lt;= 38,00<\/p>\n<p>99,9% &lt;= 38,00<\/p>\n<p>[MEM] Tempo m\u00e9dio no fio para opera\u00e7\u00f5es (\u00b5s)<\/p>\n<p>contagem = 893<\/p>\n<p>min = 179<\/p>\n<p>max = 1730<\/p>\n<p>m\u00e9dia = 263,80<\/p>\n<p>desvio padr\u00e3o = 75,43<\/p>\n<p>mediana = 251,00<\/p>\n<p>75% &lt;= 280,00<\/p>\n<p>95% &lt;= 351,90<\/p>\n<p>98% &lt;= 425,36<\/p>\n<p>99% &lt;= 559,70<\/p>\n<p>99.9% &lt;= 1730.00<\/p>\n<p>- Metros ------------------------<\/p>\n<p>Taxa de solicita\u00e7\u00e3o [MEM]: Todos<\/p>\n<p>contagem = 893<\/p>\n<p>taxa m\u00e9dia = 9,92 eventos\/segundo<\/p>\n<p>Taxa de 1 minuto = 9,85 eventos\/segundo<\/p>\n<p>Taxa de 5 minutos = 9,68 eventos\/segundo<\/p>\n<p>Taxa de 15 minutos = 9,63 eventos\/segundo<\/p>\n<p>[MEM] Taxa de resposta: Todas (falha + sucesso + nova tentativa)<\/p>\n<p>contagem = 893<\/p>\n<p>taxa m\u00e9dia = 9,92 eventos\/segundo<\/p>\n<p>Taxa de 1 minuto = 9,85 eventos\/segundo<\/p>\n<p>Taxa de 5 minutos = 9,68 eventos\/segundo<\/p>\n<p>Taxa de 15 minutos = 9,63 eventos\/segundo<\/p><\/div>\n<\/div>\n<div><\/div>\n<div>I won&#8217;t go into detail of all these metrics in this blog post, please refer to the documentation for a more complete picture. One more thing I want to show you is that the metrics library is also able to expose these metrics through JMX. All you need to do is set a system property that changes the output mode: `net.spy.metrics.reporter.type=jmx`. Other possible settings are `csv` and slf4j`. If you choose a logger that prints out information at a given interval you can change it by setting `net.spy.metrics.reporter.interval` to anything else than 30.<\/div>\n<div><\/div>\n<div>So if you put the line `System.setProperty(&#8220;net.spy.metrics.reporter.type&#8221;, &#8220;jmx&#8221;);` before the code shown above, you can open (for example) jConsole and switch to the MBeans tab of the application. You&#8217;ll see a `metrics` subsection exposed that contains the same metrics as they would show up in the logs.<\/div>\n<div><\/div>\n<h2>CAS com vencimento<\/h2>\n<div>Before 1.2.0, it was not possible in one command to do a `cas` update and set a new expiration at the same time. You had to do a second `touch` operation which was not efficient nor atomic. Now, the API exposes a new `cas()` method that allows you to pass in the expiration time at the same time. It is easy to use:<\/div>\n<div><\/div>\n<div class=\"geshifilter\">\n<div class=\"java geshifilter-java\" style=\"font-family: monospace\">cliente.<span style=\"color: #006633\">cas<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #0000ff\">\"chave\"<\/span>, cas, newExpiration, value<span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/div>\n<\/div>\n<div><\/div>\n<div>As varia\u00e7\u00f5es ass\u00edncronas tamb\u00e9m foram expostas desde a vers\u00e3o 1.2.1.<\/div>\n<div><\/div>\n<h2>Inicializa\u00e7\u00e3o por meio de propriedades<\/h2>\n<div>One thing that comes in handy if your cluster ip addresses change often is that you can now initialize a `CouchbaseClient` object based on system properties. Here is an example:<\/div>\n<div><\/div>\n<div>\n<div class=\"geshifilter\">\n<div class=\"java geshifilter-java\" style=\"font-family: monospace\"><a href=\"https:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky\"><span style=\"color: #003399\">Sistema<\/span><\/a>.<span style=\"color: #006633\">setProperty<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #0000ff\">&#8220;cbclient.nodes&#8221;<\/span>, <span style=\"color: #0000ff\">\u201chttps:\/\/127.0.0.1:8091\/pools\u201d<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<a href=\"https:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky\"><span style=\"color: #003399\">Sistema<\/span><\/a>.<span style=\"color: #006633\">setProperty<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #0000ff\">&#8220;cbclient.bucket&#8221;<\/span>, <span style=\"color: #0000ff\">\"default\"<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\n<a href=\"https:\/\/www.google.com\/search?hl=en&amp;q=allinurl%3Asystem+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky\"><span style=\"color: #003399\">Sistema<\/span><\/a>.<span style=\"color: #006633\">setProperty<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #0000ff\">&#8220;cbclient.password&#8221;<\/span>, <span style=\"color: #0000ff\">&#8220;&#8221;<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/p>\n<p>Construtor do CouchbaseConnectionFactoryBuilder <span style=\"color: #339933\">=<\/span> <span style=\"color: #000000;font-weight: bold\">novo<\/span> CouchbaseConnectionFactoryBuilder<span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\nCouchbaseConnectionFactory cf <span style=\"color: #339933\">=<\/span> construtor.<span style=\"color: #006633\">buildCouchbaseConnection<\/span><span style=\"color: #009900\">(<\/span><span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><br \/>\nCliente CouchbaseClient <span style=\"color: #339933\">=<\/span> <span style=\"color: #000000;font-weight: bold\">novo<\/span> Cliente Couchbase<span style=\"color: #009900\">(<\/span>cf<span style=\"color: #009900\">)<\/span><span style=\"color: #339933\">;<\/span><\/div>\n<\/div>\n<\/div>\n<div><\/div>\n<div>Of course you can set these properties in your application container or during startup, so it&#8217;s very flexible and not tied into your code directly. Note that if you forget to set one of these properties, the code will warn you like this:<\/div>\n<div><\/div>\n<div class=\"geshifilter\">\n<div class=\"text geshifilter-text\" style=\"font-family: monospace\">Exception in thread &#8220;main&#8221; java.lang.IllegalArgumentException: System property cbclient.nodes not set or empty<br \/>\nat com.couchbase.client.CouchbaseConnectionFactory.(CouchbaseConnectionFactory.java:160)<br \/>\nat com.couchbase.client.CouchbaseConnectionFactoryBuilder$2.(CouchbaseConnectionFactoryBuilder.java:318)<br \/>\nat com.couchbase.client.CouchbaseConnectionFactoryBuilder.buildCouchbaseConnection(CouchbaseConnectionFactoryBuilder.java:318)<br \/>\nem Main.main(Main.java:33)<br \/>\nem sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br \/>\nat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)<br \/>\nem sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br \/>\nem java.lang.reflect.Method.invoke(Method.java:601)<br \/>\nat com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)<\/div>\n<\/div>\n<div><\/div>\n<h2>Outras altera\u00e7\u00f5es<\/h2>\n<div>In addition to the enhancements shown above, the release includes &#8211; as always &#8211; numerous smaller bugfixes. The default poll interval for `ReplicateTo` and `PersistTo` has been lowered to `10ms` to account for performance changes that went into the Couchbase Sever 2.2 release. Also, the client now uses the `CRAM-MD5` authentication mechanism automatically if the server supports it (since 2.2 as well).<\/div>\n<div><\/div>\n<div>Esses novos recursos incr\u00edveis devem ser motivo suficiente para fazer o upgrade agora mesmo! Se algo n\u00e3o funcionar como esperado, entre em contato com o suporte ao cliente ou abra um t\u00edquete <a href=\"https:\/\/www.couchbase.com\/blog\/pt\/issues\/browse\/JCBC\/\">aqui<\/a>.<\/div>","protected":false},"excerpt":{"rendered":"<p>[This blog was syndicated from https:\/\/nitschinger.at\/] For all users of our Java SDK, we prepared some nice additions for you. This post covers them in detail and shows how you can get more productive Note that this blog post assumes [&hellip;]<\/p>","protected":false},"author":19,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"ppma_author":[8987],"class_list":["post-1828","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.5 (Yoast SEO v26.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>What&#039;s new in the Couchbase Java SDK 1.2 - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/pt\/whats-new-couchbase-java-sdk-12\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What&#039;s new in the Couchbase Java SDK 1.2\" \/>\n<meta property=\"og:description\" content=\"[This blog was syndicated from https:\/\/nitschinger.at\/] For all users of our Java SDK, we prepared some nice additions for you. This post covers them in detail and shows how you can get more productive Note that this blog post assumes [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/pt\/whats-new-couchbase-java-sdk-12\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-17T16:21:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-28T06:16:55+00:00\" \/>\n<meta name=\"author\" content=\"Michael Nitschinger\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@daschl\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Nitschinger\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/\"},\"author\":{\"name\":\"Michael Nitschinger\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e5d4d332756da6f361dd88c1576de61d\"},\"headline\":\"What&#8217;s new in the Couchbase Java SDK 1.2\",\"datePublished\":\"2014-12-17T16:21:28+00:00\",\"dateModified\":\"2023-06-28T06:16:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/\"},\"wordCount\":1469,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"Uncategorized\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/\",\"name\":\"What's new in the Couchbase Java SDK 1.2 - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2014-12-17T16:21:28+00:00\",\"dateModified\":\"2023-06-28T06:16:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What&#8217;s new in the Couchbase Java SDK 1.2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e5d4d332756da6f361dd88c1576de61d\",\"name\":\"Michael Nitschinger\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/95e178617974d46e3b02dd1754a3f60b\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/dad99b5e02a74ca4bec14352e9da710160647a97290814b669babb3aac0ea675?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/dad99b5e02a74ca4bec14352e9da710160647a97290814b669babb3aac0ea675?s=96&d=mm&r=g\",\"caption\":\"Michael Nitschinger\"},\"description\":\"Michael Nitschinger works as a Principal Software Engineer at Couchbase. He is the architect and maintainer of the Couchbase Java SDK, one of the first completely reactive database drivers on the JVM. He also authored and maintains the Couchbase Spark Connector. Michael is active in the open source community, a contributor to various other projects like RxJava and Netty.\",\"sameAs\":[\"https:\/\/nitschinger.at\",\"https:\/\/x.com\/daschl\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/pt\/author\/michael-nitschinger\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"What's new in the Couchbase Java SDK 1.2 - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/pt\/whats-new-couchbase-java-sdk-12\/","og_locale":"pt_BR","og_type":"article","og_title":"What's new in the Couchbase Java SDK 1.2","og_description":"[This blog was syndicated from https:\/\/nitschinger.at\/] For all users of our Java SDK, we prepared some nice additions for you. This post covers them in detail and shows how you can get more productive Note that this blog post assumes [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/pt\/whats-new-couchbase-java-sdk-12\/","og_site_name":"The Couchbase Blog","article_published_time":"2014-12-17T16:21:28+00:00","article_modified_time":"2023-06-28T06:16:55+00:00","author":"Michael Nitschinger","twitter_card":"summary_large_image","twitter_creator":"@daschl","twitter_misc":{"Written by":"Michael Nitschinger","Est. reading time":"7 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/"},"author":{"name":"Michael Nitschinger","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e5d4d332756da6f361dd88c1576de61d"},"headline":"What&#8217;s new in the Couchbase Java SDK 1.2","datePublished":"2014-12-17T16:21:28+00:00","dateModified":"2023-06-28T06:16:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/"},"wordCount":1469,"commentCount":1,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":["Uncategorized"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/","url":"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/","name":"What's new in the Couchbase Java SDK 1.2 - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2014-12-17T16:21:28+00:00","dateModified":"2023-06-28T06:16:55+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/whats-new-couchbase-java-sdk-12\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"What&#8217;s new in the Couchbase Java SDK 1.2"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"Blog do Couchbase","description":"Couchbase, o banco de dados NoSQL","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"Blog do Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/e5d4d332756da6f361dd88c1576de61d","name":"Michael Nitschinger","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/95e178617974d46e3b02dd1754a3f60b","url":"https:\/\/secure.gravatar.com\/avatar\/dad99b5e02a74ca4bec14352e9da710160647a97290814b669babb3aac0ea675?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dad99b5e02a74ca4bec14352e9da710160647a97290814b669babb3aac0ea675?s=96&d=mm&r=g","caption":"Michael Nitschinger"},"description":"Michael Nitschinger trabalha como engenheiro de software principal na Couchbase. Ele \u00e9 o arquiteto e mantenedor do Couchbase Java SDK, um dos primeiros drivers de banco de dados totalmente reativos na JVM. Ele tamb\u00e9m \u00e9 o autor e mantenedor do Couchbase Spark Connector. Michael participa ativamente da comunidade de c\u00f3digo aberto e contribui para v\u00e1rios outros projetos, como RxJava e Netty.","sameAs":["https:\/\/nitschinger.at","https:\/\/x.com\/daschl"],"url":"https:\/\/www.couchbase.com\/blog\/pt\/author\/michael-nitschinger\/"}]}},"authors":[{"term_id":8987,"user_id":19,"is_guest":0,"slug":"michael-nitschinger","display_name":"Michael Nitschinger","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/dad99b5e02a74ca4bec14352e9da710160647a97290814b669babb3aac0ea675?s=96&d=mm&r=g","author_category":"","last_name":"Nitschinger, Principal Software Engineer, Couchbase","first_name":"Michael","job_title":"","user_url":"https:\/\/nitschinger.at","description":"Michael Nitschinger trabalha como engenheiro de software principal na Couchbase. Ele \u00e9 o arquiteto e mantenedor do Couchbase Java SDK, um dos primeiros drivers de banco de dados totalmente reativos na JVM. Ele tamb\u00e9m \u00e9 o autor e mantenedor do Couchbase Spark Connector. Michael participa ativamente da comunidade de c\u00f3digo aberto e contribui para v\u00e1rios outros projetos, como RxJava e Netty."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/1828","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/comments?post=1828"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/posts\/1828\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/media?parent=1828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/categories?post=1828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/tags?post=1828"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/pt\/wp-json\/wp\/v2\/ppma_author?post=1828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}