Commit b5d35f66c4b1cf3439d3b145d52f258f974eebca
1 parent
a41e4538
Exists in
master
Resolvendo a advertência do Sonar: Bad practice - Serializable inner
Showing
2 changed files
with
16 additions
and
14 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/transaction/TransactionalInterceptor.java
| ... | ... | @@ -81,15 +81,7 @@ public class TransactionalInterceptor implements Serializable { |
| 81 | 81 | instance.getCounter(); |
| 82 | 82 | |
| 83 | 83 | } catch (ContextNotActiveException cause) { |
| 84 | - instance = new TransactionInfo() { | |
| 85 | - | |
| 86 | - private static final long serialVersionUID = 1L; | |
| 87 | - | |
| 88 | - @Override | |
| 89 | - public boolean isOwner() { | |
| 90 | - return false; | |
| 91 | - } | |
| 92 | - }; | |
| 84 | + instance = new VoidTransactionInfo(); | |
| 93 | 85 | } |
| 94 | 86 | |
| 95 | 87 | return instance; |
| ... | ... | @@ -194,4 +186,14 @@ public class TransactionalInterceptor implements Serializable { |
| 194 | 186 | |
| 195 | 187 | return logger; |
| 196 | 188 | } |
| 189 | + | |
| 190 | + private static class VoidTransactionInfo extends TransactionInfo { | |
| 191 | + | |
| 192 | + private static final long serialVersionUID = 1L; | |
| 193 | + | |
| 194 | + @Override | |
| 195 | + public boolean isOwner() { | |
| 196 | + return false; | |
| 197 | + } | |
| 198 | + } | |
| 197 | 199 | } | ... | ... |
impl/extension/jdbc/src/main/java/br/gov/frameworkdemoiselle/transaction/JDBCTransaction.java
| ... | ... | @@ -126,12 +126,12 @@ public class JDBCTransaction implements Transaction { |
| 126 | 126 | public boolean isActive() { |
| 127 | 127 | Status status; |
| 128 | 128 | boolean result = true; |
| 129 | - | |
| 129 | + | |
| 130 | 130 | for (Connection connection : getDelegate()) { |
| 131 | 131 | status = cache.get(connection); |
| 132 | 132 | result = result && status.isActive(); |
| 133 | 133 | } |
| 134 | - | |
| 134 | + | |
| 135 | 135 | return result; |
| 136 | 136 | } |
| 137 | 137 | |
| ... | ... | @@ -139,16 +139,16 @@ public class JDBCTransaction implements Transaction { |
| 139 | 139 | public boolean isMarkedRollback() { |
| 140 | 140 | Status status; |
| 141 | 141 | boolean result = true; |
| 142 | - | |
| 142 | + | |
| 143 | 143 | for (Connection connection : getDelegate()) { |
| 144 | 144 | status = cache.get(connection); |
| 145 | 145 | result = result && status.isMarkedRollback(); |
| 146 | 146 | } |
| 147 | - | |
| 147 | + | |
| 148 | 148 | return result; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - private class Status implements Serializable { | |
| 151 | + private static class Status implements Serializable { | |
| 152 | 152 | |
| 153 | 153 | private static final long serialVersionUID = 1L; |
| 154 | 154 | ... | ... |