"?" en los genericos ese es un tipo de dato cuarquiera
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menútry {
Desktop.getDesktop().open(new File(getClass().getResource("/bd/Crystal.xml").getFile()));
} catch (IOException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}
/**
*
* @author L-eyer
*/
class mainClass{
//---------------------------------------------------
public static void main(final String[] args){
threadForTasks tasks = new threadForTasks();
new ThreadControl(tasks);
tasks.start();
}
}
class threadForTasks extends Thread{
private int task = 0 ;
private boolean active = true ;
private boolean received = false;
public int getTask() {return task;}
public void setTask(int index) {this.task = index;}
@Override public synchronized void run(){
while(active){
try {
Thread.sleep(500);
} catch (InterruptedException e) {e.printStackTrace();
}
System.out.println("-----------------------------------");
System.out.println(":Performing the task : "+task);
System.out.println("-----------------------------------");
task++;
received = true;
try {
wait();
} catch (InterruptedException e1) {e1.printStackTrace();
}
}
}
public boolean isReceived() {
return received;
}
public void setReceived(boolean received) {
this.received = received;
}
public threadForTasks() {super("Thread For Tasks");
}
}
public class ThreadControl extends Thread{
private threadForTasks thread;
private boolean activated = true ;
@Override public synchronized void run(){
while(activated){
try {if(thread.isReceived()){
System.out.println("\n"+getName()+"->Obtained:Task "+thread.getTask()+"");
synchronized(thread){
System.out.println("->Restarting.."+thread.getName());
Thread.sleep(1000);
thread.setReceived(false);
thread.notify();
}
}
Thread.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public boolean isActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
public ThreadControl(threadForTasks threadNro1) {super("Thread Control");
this.thread = threadNro1;
start();
}
import java.io.File;
import java.util.ArrayList;
/*
* @author L-EYER
*/
public class listFiles extends Thread{
private File file = null;
private ArrayList<File> arrayListFiles = new ArrayList<File>();
private ArrayList<File> arrayListDir = new ArrayList<File>();
private ArrayList<File> arrayListFilesHiden= new ArrayList<File>();
int size = 0;
private File[] list = null;
public listFiles(String path){
super(":");
setPriority(MAX_PRIORITY);
file = new File(path);
}
@Override
public void run() {
list = file.listFiles();
size = list.length;
for(int index=0;index<size;index++){
if(list[index].isFile()){ arrayListFiles .add(list[index]);
}else if(list[index].isDirectory()){arrayListDir .add(list[index]);
}else if(list[index].isHidden()){ arrayListFilesHiden.add(list[index]);
}
}
System.out.println("- [Directorios] -");
System.out.println(arrayListDir);
System.out.println("\n");
System.out.println("- [Archivos] -");
System.out.println(arrayListFiles);
}
public ArrayList<File> getArrayListFiles() {
return arrayListFiles;
}
public void setArrayListFiles(ArrayList<File> arrayListFiles) {
this.arrayListFiles = arrayListFiles;
}
public ArrayList<File> getArrayListDir() {
return arrayListDir;
}
public void setArrayListDir(ArrayList<File> arrayListDir) {
this.arrayListDir = arrayListDir;
}
}
class mainClass{
public static void main(String[] args){
String path = "C:\\WINDOWS\\System32";
if(new File(path).exists()){
listFiles listfiles = new listFiles(path);
listfiles.start();
}
}
}