cancel
Showing results for 
Search instead for 
Did you mean: 

TransactionServiceImpl.isReadOnly() no always false for server.allowWrite=false

lutz_horn
Champ in-the-making
Champ in-the-making
Setting the property
server.allowWrite=false
does not always make
TransactionServiceImpl.isReadOnly()
return
true
.

I've a Quartz cron job which runs every minute
0 * * * * ?
. The code ueses
TransactionServiceImpl.isReadOnly()
to check if the repostiotry is in read-only mode. Every few minutes, this call returns
false
, even though the property ist set.

What could cause
TransactionServiceImpl.isReadOnly()
to think that the system is <strong>not</strong> in read-only mode? I see

<blockcode>
            if (AuthenticationUtil.isRunAsUserTheSystemUser())
            {
                return false;
            }
</blockcode>

which means, that the system user can <strong>always</strong>. That is strage.

Is there a stable way to know in Java code if the repository is in read-only mode?
2 REPLIES 2

mrogers
Star Contributor
Star Contributor
After a quick look at the java doc.   I think you should be using TransactionServioce.isAllowWrite

As you have seen the system user can always write.    Yes its a bit strange but there are operations like installing a license or fixing a index that need to go ahead on a read only repository.

lutz_horn
Champ in-the-making
Champ in-the-making
Good, hint, thank you. I didn't expect a method
getAllowWrite
to even exist and to behave differently from
isAllowWrite
.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.