From 4e98f79fcaabc79d752b97a14058ea63ed3da377 Mon Sep 17 00:00:00 2001 From: Tigran Mkrtchyan Date: Mon, 28 Dec 2020 18:31:23 +0100 Subject: [PATCH] rpc: make empty Subject static final field As it never changes Acked-by: Lea Morschel Acked-by: Paul Millar Target: master --- .../java/org/dcache/oncrpc4j/rpc/RpcAuthTypeNone.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/oncrpc4j-core/src/main/java/org/dcache/oncrpc4j/rpc/RpcAuthTypeNone.java b/oncrpc4j-core/src/main/java/org/dcache/oncrpc4j/rpc/RpcAuthTypeNone.java index 21c14141..2c8f7d4b 100755 --- a/oncrpc4j-core/src/main/java/org/dcache/oncrpc4j/rpc/RpcAuthTypeNone.java +++ b/oncrpc4j-core/src/main/java/org/dcache/oncrpc4j/rpc/RpcAuthTypeNone.java @@ -33,7 +33,12 @@ public class RpcAuthTypeNone implements RpcAuth, XdrAble { private final int _type = RpcAuthType.NONE; private byte[] body; private RpcAuthVerifier _verifier = new RpcAuthVerifier(RpcAuthType.NONE, new byte[0]); - private final Subject _subject; + + private static final Subject _subject; + static { + _subject = new Subject(); + _subject.setReadOnly(); + } private final static Logger _log = LoggerFactory.getLogger(RpcAuthTypeNone.class); @@ -43,8 +48,6 @@ public RpcAuthTypeNone() { public RpcAuthTypeNone(byte[] body) { this.body = body; - _subject = new Subject(); - _subject.setReadOnly(); } @Override