Coverage Report - com.jcabi.dynamo.retry.ReTable
 
Classes in this File Line Coverage Branch Coverage Complexity
ReTable
58%
7/12
0%
0/12
1
ReTable$AjcClosure1
100%
1/1
N/A
1
ReTable$AjcClosure11
0%
0/1
N/A
1
ReTable$AjcClosure13
0%
0/1
N/A
1
ReTable$AjcClosure15
0%
0/1
N/A
1
ReTable$AjcClosure17
100%
1/1
N/A
1
ReTable$AjcClosure19
100%
1/1
N/A
1
ReTable$AjcClosure3
100%
1/1
N/A
1
ReTable$AjcClosure5
0%
0/1
N/A
1
ReTable$AjcClosure7
0%
0/1
N/A
1
ReTable$AjcClosure9
0%
0/1
N/A
1
 
 1  2
 /**
 2  
  * Copyright (c) 2012-2016, jcabi.com
 3  
  * All rights reserved.
 4  
  *
 5  
  * Redistribution and use in source and binary forms, with or without
 6  
  * modification, are permitted provided that the following conditions
 7  
  * are met: 1) Redistributions of source code must retain the above
 8  
  * copyright notice, this list of conditions and the following
 9  
  * disclaimer. 2) Redistributions in binary form must reproduce the above
 10  
  * copyright notice, this list of conditions and the following
 11  
  * disclaimer in the documentation and/or other materials provided
 12  
  * with the distribution. 3) Neither the name of the jcabi.com nor
 13  
  * the names of its contributors may be used to endorse or promote
 14  
  * products derived from this software without specific prior written
 15  
  * permission.
 16  
  *
 17  
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 18  
  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
 19  
  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 20  
  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 21  
  * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 22  
  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 23  
  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 24  
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 25  
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 26  
  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 27  
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 28  
  * OF THE POSSIBILITY OF SUCH DAMAGE.
 29  
  */
 30  
 package com.jcabi.dynamo.retry;
 31  
 
 32  
 import com.amazonaws.services.dynamodbv2.model.AttributeValue;
 33  
 import com.jcabi.aspects.Immutable;
 34  
 import com.jcabi.aspects.Loggable;
 35  
 import com.jcabi.aspects.RetryOnFailure;
 36  
 import com.jcabi.aspects.Tv;
 37  
 import com.jcabi.dynamo.Frame;
 38  
 import com.jcabi.dynamo.Item;
 39  
 import com.jcabi.dynamo.Region;
 40  
 import com.jcabi.dynamo.Table;
 41  
 import java.io.IOException;
 42  
 import java.util.Map;
 43  
 import java.util.concurrent.TimeUnit;
 44  
 import lombok.EqualsAndHashCode;
 45  
 import lombok.ToString;
 46  
 
 47  
 /**
 48  
  * Table that retries on failure.
 49  
  *
 50  
  * @author Yegor Bugayenko (yegor@tpc2.com)
 51  
  * @version $Id: bbd97851ada8f76592eb778626bab00c9626b530 $
 52  
  * @since 0.9
 53  
  */
 54  
 @Immutable
 55  
 @Loggable(Loggable.DEBUG)
 56  1
 @ToString
 57  0
 @EqualsAndHashCode(of = "origin")
 58  
 public final class ReTable implements Table {
 59  
 
 60  
     /**
 61  
      * Original table.
 62  
      */
 63  
     private final transient Table origin;
 64  
 
 65  
     /**
 66  
      * Public ctor.
 67  
      * @param table Origin table
 68  
      */
 69  2
     public ReTable(final Table table) {
 70  2
         this.origin = table;
 71  2
     }
 72  
 
 73  
     @Override
 74  
     @RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS)
 75  
     public Item put(final Map<String, AttributeValue> attributes)
 76  
         throws IOException {
 77  5
         return this.origin.put(attributes);
 78  
     }
 79  
 
 80  
     @Override
 81  
     @RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS)
 82  
     public Frame frame() {
 83  0
         return new ReFrame(this.origin.frame());
 84  
     }
 85  
 
 86  
     @Override
 87  
     @RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS)
 88  
     public Region region() {
 89  0
         return new ReRegion(this.origin.region());
 90  
     }
 91  
 
 92  
     @Override
 93  
     @RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS)
 94  
     public String name() {
 95  0
         return this.origin.name();
 96  
     }
 97  
 
 98  
     @Override
 99  
     @RetryOnFailure(verbose = false, delay = Tv.FIVE, unit = TimeUnit.SECONDS)
 100  
     public void delete(final Map<String, AttributeValue> attributes)
 101  
         throws IOException {
 102  5
         this.origin.delete(attributes);
 103  0
     }
 104  
 }