1 17 package org.apache.log.output.io.rotate; 18 19 import java.io.File ; 20 21 30 public class OrRotateStrategy 31 implements RotateStrategy 32 { 33 private RotateStrategy[] m_strategies; 34 35 38 private int m_usedRotation = -1; 39 40 44 public OrRotateStrategy( final RotateStrategy[] strategies ) 45 { 46 this.m_strategies = strategies; 47 } 48 49 52 public void reset() 53 { 54 for( int i = 0; i < m_strategies.length; i++ ) 55 { 56 m_strategies[ i ].reset(); 57 } 58 } 59 60 70 public boolean isRotationNeeded( final String data, final File file ) 71 { 72 m_usedRotation = -1; 73 74 if( null != m_strategies ) 75 { 76 final int length = m_strategies.length; 77 for( int i = 0; i < length; i++ ) 78 { 79 if( true == m_strategies[ i ].isRotationNeeded( data, file ) ) 80 { 81 m_usedRotation = i; 82 return true; 83 } 84 } 85 } 86 87 return false; 88 } 89 } 90 91 | Popular Tags |