@ -14,15 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License .
* /
package org.apache.dolphinscheduler.server.master.runner ;
import java.util.concurrent.ThreadPoolExecutor ;
import java.util.concurrent.TimeUnit ;
import javax.annotation.PostConstruct ;
package org.apache.dolphinscheduler.server.master.runner ;
import org.apache.curator.framework.imps.CuratorFrameworkState ;
import org.apache.curator.framework.recipes.locks.InterProcessMutex ;
import org.apache.dolphinscheduler.common.Constants ;
import org.apache.dolphinscheduler.common.thread.Stopper ;
import org.apache.dolphinscheduler.common.thread.ThreadUtils ;
@ -36,6 +30,15 @@ import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.utils.AlertManager ;
import org.apache.dolphinscheduler.server.zk.ZKMasterClient ;
import org.apache.dolphinscheduler.service.process.ProcessService ;
import org.apache.curator.framework.imps.CuratorFrameworkState ;
import org.apache.curator.framework.recipes.locks.InterProcessMutex ;
import java.util.concurrent.ThreadPoolExecutor ;
import java.util.concurrent.TimeUnit ;
import javax.annotation.PostConstruct ;
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
import org.springframework.beans.factory.annotation.Autowired ;
@ -90,14 +93,14 @@ public class MasterSchedulerService extends Thread {
* constructor of MasterSchedulerService
* /
@PostConstruct
public void init ( ) {
public void init ( ) {
this . masterExecService = ( ThreadPoolExecutor ) ThreadUtils . newDaemonFixedThreadExecutor ( "Master-Exec-Thread" , masterConfig . getMasterExecThreads ( ) ) ;
NettyClientConfig clientConfig = new NettyClientConfig ( ) ;
this . nettyRemotingClient = new NettyRemotingClient ( clientConfig ) ;
}
@Override
public synchronized void start ( ) {
public synchronized void start ( ) {
super . setName ( "MasterSchedulerService" ) ;
super . start ( ) ;
}
@ -110,7 +113,7 @@ public class MasterSchedulerService extends Thread {
} catch ( InterruptedException ignore ) {
Thread . currentThread ( ) . interrupt ( ) ;
}
if ( ! terminated ) {
if ( ! terminated ) {
logger . warn ( "masterExecService shutdown without terminated, increase await time" ) ;
}
nettyRemotingClient . close ( ) ;
@ -123,7 +126,7 @@ public class MasterSchedulerService extends Thread {
@Override
public void run ( ) {
logger . info ( "master scheduler started" ) ;
while ( Stopper . isRunning ( ) ) {
while ( Stopper . isRunning ( ) ) {
try {
boolean runCheckFlag = OSUtils . checkResource ( masterConfig . getMasterMaxCpuloadAvg ( ) , masterConfig . getMasterReservedMemory ( ) ) ;
if ( ! runCheckFlag ) {