为什么notifyAll()函数不在这里工作?我怎么编辑它?

时间:2017-01-25 11:49:37

标签: android

为什么没有notifyAll()函数在这里工作?我应该编辑什么才能使它工作?

    clear
#Sets year variable
date +"%Y"
# Store Year variable
cyear=$(date +'%Y')
echo "Year = $cyear"
clear

#changes the directory to the back up directory and makes sure the year is correct
cd /Users/DBUP/BUP
if [ ! -d "$cyear" ]; 
    then mkdir $cyear;
fi
clear
echo "Year $cyear Created or Found"
sleep 2s
clear

#Creates all of the months within a year
cd /Users/DBUP/BUP/$cyear
mkdir 01;
mkdir 02;
mkdir 03;
mkdir 04;
mkdir 05;
mkdir 06;
mkdir 07;
mkdir 08;
mkdir 09;
mkdir 10; 
mkdir 11;
mkdir 12;
clear
echo "Months Created or Found"
sleep 2s
clear   

#Creates the week files in each month
#Month 01 Start
cd /Users/DBUP/BUP/$cyear/01
if [ ! -d "wk1" ];
    then mkdir wk1
    cp -a /Users/user/Dropbox/. /Users/DBUP/BUP/$cyear/01/wk1
    clear
    echo "Week 1, month 1 Back Up Completed";
else if [ ! -d "wk2" ]; 
    then mkdir wk2; 
    cp -a /Users/user/Dropbox/. /Users/DBUP/BUP/$cyear/01/wk2;
    clear;
    echo "Week 2, month 1 Back Up Completed";
else if [ ! -d "wk3" ];
    then mkdir wk3; 
    cp -a /Users/user/Dropbox/. /Users/DBUP/BUP/$cyear/01/wk3;
    clear;
    echo "Week 3, month 1 Back Up Completed";
else    if [ ! -d "wk4" ];
    then mkdir wk4;
    cp -a /Users/user/Dropbox/. /Users/DBUP/BUP/$cyear/01/wk4;
    clear;
    echo "Week 4, month 1 Back Up Completed";
#Month 01 End 

#Month 01
fi
fi
fi
fi
#End

1 个答案:

答案 0 :(得分:0)

通过将synchronized放在方法中,将其替换为synchronized block并将字段(类范围)对象创建为锁定器,锁定内部类对象。