@ -69,6 +69,19 @@ public class Meta {
@@ -69,6 +69,19 @@ public class Meta {
this . allowDiskUse = source . allowDiskUse ;
}
/ * *
* Return whether the maximum time limit for processing operations is set .
*
* @return { @code true } if set ; { @code false } otherwise .
* @since 4 . 0 . 6
* /
public boolean hasMaxTime ( ) {
Long maxTimeMsec = getMaxTimeMsec ( ) ;
return maxTimeMsec ! = null & & maxTimeMsec > 0 ;
}
/ * *
* @return { @literal null } if not set .
* /
@ -77,6 +90,26 @@ public class Meta {
@@ -77,6 +90,26 @@ public class Meta {
return getValue ( MetaKey . MAX_TIME_MS . key ) ;
}
/ * *
* Returns the required maximum time limit in milliseconds or throws { @link IllegalStateException } if the maximum time
* limit is not set .
*
* @return the maximum time limit in milliseconds for processing operations .
* @throws IllegalStateException if the maximum time limit is not set
* @see # hasMaxTime ( )
* @since 4 . 0 . 6
* /
public Long getRequiredMaxTimeMsec ( ) {
Long maxTimeMsec = getMaxTimeMsec ( ) ;
if ( maxTimeMsec = = null ) {
throw new IllegalStateException ( "Maximum time limit in milliseconds not set" ) ;
}
return maxTimeMsec ;
}
/ * *
* Set the maximum time limit in milliseconds for processing operations .
*
@ -99,12 +132,13 @@ public class Meta {
@@ -99,12 +132,13 @@ public class Meta {
}
/ * *
* Add a comment to the query that is propagated to the profile log .
* Return whether the comment is set .
*
* @param comment
* @return { @code true } if set ; { @code false } otherwise .
* @since 4 . 0 . 6
* /
public void setComment ( String comment ) {
setValue ( MetaKey . COMMENT . key , comment ) ;
public boolean hasComment ( ) {
return StringUtils . hasText ( getComment ( ) ) ;
}
/ * *
@ -115,6 +149,34 @@ public class Meta {
@@ -115,6 +149,34 @@ public class Meta {
return getValue ( MetaKey . COMMENT . key ) ;
}
/ * *
* Returns the required comment or throws { @link IllegalStateException } if the comment is not set .
*
* @return the comment .
* @throws IllegalStateException if the comment is not set
* @see # hasComment ( )
* @since 4 . 0 . 6
* /
public String getRequiredComment ( ) {
String comment = getComment ( ) ;
if ( comment = = null ) {
throw new IllegalStateException ( "Comment not set" ) ;
}
return comment ;
}
/ * *
* Add a comment to the query that is propagated to the profile log .
*
* @param comment
* /
public void setComment ( String comment ) {
setValue ( MetaKey . COMMENT . key , comment ) ;
}
/ * *
* @return { @literal null } if not set .
* @since 2 . 1